LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   What is Wrong with my CRON? (https://www.linuxquestions.org/questions/programming-9/what-is-wrong-with-my-cron-229777/)

Rv5 09-12-2004 04:37 PM

What is Wrong with my CRON?
 
With the better advice of members on this board, ive been playing with cron a bit for automation. However, I cant seem to get cron to run my custom scripts.

For example Ill try the following:

# crontab
11 14 12 9 * /root/school/at/crontest
cnrtl D

the only line in this script is:
date >> curdate

curdate exists in the at directory
so i expected this to run at 2:11 today, but it didnt.

now if i do something like
# crontab
11 14 12 9 * date >> /root/school/at/curdate
cnrtl D

that will work, but why not my script?

ive run the script on my own and it works fine, just not with cron?

Worstje 09-12-2004 06:03 PM

1) Add this as the first line of your script:

#!/bin/sh

Your terminal might understand how to interpret your script, but crond can't, so the system will have to depend on this line to know how to execute it.

2) I recently learned a good lesson (:rolleyes:) on paths. System applications will probably always work, but in other cases it might be a fine idea to specify the entire path which you'd get when using "whereis application".

Rv5 09-12-2004 06:34 PM

tried adding #!/bin/sh, which i should get in the habit of, but still didnt work. any other ideas?

Worstje 09-13-2004 01:28 AM

Try using * * * * * to make the cronjob run every minute.. Maybe you just got the date wrong or something like that :)


All times are GMT -5. The time now is 01:32 PM.