I want to create a cron task in my debian system.
I do this
sudo crontab -e
and add a line
10 17 * * * /home/userdir/cron/meiwei-slide-shoot.sh
And I do this at 17:00 and hope the script run at 17:10. But it doesnt work.
I have tried the script. It works well. But why not it run by cron?
Have you checked that the file is executable?
Have you added a line like:
to the top of the script to check whether it’s starting, and just dropping out for some other reason, like an incomplete environment setup?
Have you received mail from
croncontaining the output/error?Have you checked in the
cronspool directory (such as/var/spool/cron/crontabs) to ensure the entry has been created?There are a large number of things you could have missed, that’s just the common ones, but a good start.
A good test is to add:
to your
crontaband watch to see if that file appears.