I have a script, /etc/init.d/xxx, which I want to restart at 3am every morning.
If I use
sudo crontab -e
.. and add
MAILTO=<my email>
0 3 * * * /etc/init.d/xxx restart
.. I get an email at 3am telling me that start-stop-daemon can't be found, so
I assume that the environment isn't set up correctly?
If I try creating:
/etc/cron.d/xxx
comprising
MAILTO=<my email>
0 3 * * * root /etc/init.d/xxx restart
.. then restart crond, I get no email and nothing appears to happen (I've
tried with/without the MAILTO).
On the other hand, just straight editing /etc/crontab and adding
MAILTO=<my email>
0 3 * * * root /etc/init.d/xxx restart
.. works a treat.
I don't want to be directly editing /etc/crontab so where am I going wrong?
Note that /etc/init.d/xxx is hand-crafted so could well be at fault here.
--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER