A simple tip for debugging Cron
Posted on May 8, 2007
Filed Under Linux
I’ve started automating my backups using cron, and never having used it, I quickly stumbled into a problem.
I have a large number of websites, so it made sense to back them up daily using scripts. However, I was having problems with my hosting provider because it did not change to the user’s local directory before executing scripts, and thus could not use relative paths to find additional scripts that I was using.
So here’s my tip, make sure your email address has been specified in the file. My host had not set this up correctly, and so I could make sure the script was being run by overriding the mailto parameter. This way, if a problem occurs, you receive the output. When editing a cron schedule file, simply put this line at the top:
MAILTO=”your@email.address.co.uk”
Then you can get all of the problems delivered to your inbox!