bash script cron job
I can't figure out why this script will not run from the crontab -e from a User who owns it.
Runs fine manually via #./listUPDATE I edited crontab -e to this - 0 0 * * * /home/User/apache/listUPDATE ...nothing happens, will not execute. I also tried editing it to - 0 0 * * * /home/User/apache/listUPDATE > /home/User/cron.log but nothing is written to the file to give me a clue as to any errors. Any ideas? Is my syntax wrong? The User executing the job has cron.allow and also has owner/group permissions to script. Any help would be appreciated, thank you:) |
Is the cron daemon running? Do any other cron jobs work?
Is everything you've shown done as the same non-root user? (The # prompt is usual for root.) Is anything on this logged in /var/log/messages? |
Quote:
Ahh yes, # oops, meant $ lol. No there is nothing under /var/log/messages. I haven't tried any other cron jobs but yes the cron daemon is running. Yes everything is run/owned by non-root user. |
the most simple test is to write a one-liner like:
echo "here I am" > /tmp/crontabtest insert it into crontab and you can check if it works next step is to put it into the beginning of your script. next to save not only stdout but stderr: 0 0 * * * /home/User/apache/listUPDATE > /home/User/cron.log 2>/home/User/cron2.log check if those files really can be written... |
Quote:
Check, these all work. ...wait, what do you mean "insert" into script? Do you mean edit my listUPDATE script with this? |
yes, as a check you can try to create a file from the script. That will be a trivial sign, the script has been started (the suggested way is to write its own pid into a file).
Next, you will need to check stderr also you can insert set -xv into the script to see what's happening |
Quote:
...which would be I'm an idiot. I wasn't entering the script in crontab but rather the path to the script with it's name (listUPDATE). sooo, problem solved, thank you for letting me waste your time. |
"When you have eliminated the impossible, whatever remains, however improbable, must be the truth"
|
All times are GMT -5. The time now is 06:59 PM. |