I have never added a cron job and am not much use with shell either…
My chosen cron directory is /etc/cron.daily/
all I need my script to do is run a php file daily. I would be nice if it ran at 11:00 AM.
Is this all I need for the 'script'?:
#!/bin/sh
php myphppage.php
how (what command) do I 'submit' the script to the cron.daily?
Sincere thanks!
Best Answer
You should setup a cron task by yourself instead.
Just type
crontab -e
to edit the crontab and add the following to run your script every days at 11:00 AM :Or run your PHP script directly from crontab :
Save and exit.
If you want to use an external script call (first sample i used with
script.sh
), you should specify full path to binaries/script within your shell script :As a side note, using the appropriate shebang in your PHP script you don't even need to specify the program to use to run your script. Add the following at the beginning of your PHP file :
Then your crontab will just look like this :