In order to activate error logging specifically for this crontab entry you can redirect the error to a file.
* * * * * /home/mustafa/Desktop/capture2/capture2 `date +\%y\%m\%d\%H\%M` 1>>/home/mustafa/Desktop/webcam.log 2>>/home/mustafa/Desktop/error.log
1>>/home/mustafa/Desktop/webcam.log
appends the output from the script to the file webcam.log
2>>/home/mustafa/Desktop/error.log
appends the error from the scripts to the file error.log
A few things that we need to take care of before executing a script from the crontab,
The user who has the crontab entry to execute the script should have access to all files that are being used by the script, including execute
permissions to the script file. For files where the script is writing/appending, the user should have write
permissions.
All paths in the script file should be absolute paths. Preferably set variables in the start of the script that stores the path to the files.
After you have checked the above two points, try executing the script using crontab, and check the error.log
file for errors. Depending on what errors you have there, you can make appropriate changes to your script.
man 5 crontab
) If not, what is the line you inserted into your crontab? – sr_ Dec 05 '11 at 10:32set -x;
at the beginning of the command. This guarantees that you will get some log (if you don't, your local mail isn't set up properly). – Gilles 'SO- stop being evil' Dec 05 '11 at 18:47