I am working on cent-OS server. I have two scripts to run by cron. Scripts are in PHP and i have a Apache module of PHP installed on cent-OS. One Script should run everyday at 6pm and other on every Thursday. My cron commands are:
00 18 * * * lynx -dump http://domain/folder1/script1.php //every Day
00 02 * * 5 lynx -dump http://domain/folder1/script2.php //every Thursday at 2am
i wrote both the lines in my /etc/crontab
file and tried to execute it from
[root@domain ~]# /etc/crontab crontab
-bash: /etc/crontab: Permission denied
Searched online but no solutions. Any ideas what i am missing?
Best Answer
crontab
is not an executable file. It is used by cron to know when the jobs should be scheduled./etc/crontab
is not executable (hence the error)Your crontab file is invalid (comments in C or Java style ere not allowed):
from the man page:
You should write something like:
Notice that
lynx -dump
will just print the page to standard output. If you want to store it somewhere you need to redirect the output to a file (see example)To see if it works wait until 00:18 or use a time nearer in the future for testing purposes