I am currently running iPrint and iFolder 3.8 on the same server. For some reason I am having the Apache2 service hang due to a mono issue and I have to run the following items on the server to get the iPrint/iFolder service back online. This might not happen for several weeks then I might see the service hang several times a day.

rcapache2 stop
ps -A | grep mono
{get the mono PID info}
Kill <PID> {for each mono instance}
rcapache2 start

I am wondering if there is a script that can do this for me. looking to have it run constantly checking if apache2 is still responding and if not running the above code.

I am new at the bash script and getting a cron job running so code examples and/or how to set this up would be great.

Thanks for the assistance.