What's the best way to stop/start a particular service on a schedule using cron?
I tried running
service servicename stop in a cron job but that didn't appear to work so switched to
0 19 * * * /etc/init.d/servicename stop >/dev/null 2>&1 0 7 * * * /etc/init.d/servicename start >/dev/null 2>&1
That appears to work, not sure how consistently yet.
But the strange thing is that I get an e-mail from cron with the following error:
/bin/sh: line 1: 20178 Terminated /etc/init.d/servicename start > /dev/null 2>&1
I only seem to get this error on the starting of the service. The stopping appears to be fine.
Also I thought that the
>/dev/null 2>&1 should suppress the e-mailing of notifications. In this case though I'm glad it didn't.
Anyone know of a better way to stop/start services on a schedule, hopefully using cron?
Anyone got any idea what this error is about?