Page 1 of 1
Cron jobs
Posted: Tue Feb 22, 2005 12:12 pm
by Joe
Is it possible to create a cron job using PHP?. If so, can anyone please point my in the right direction as I am fairly new to crontab.
Joe

Posted: Tue Feb 22, 2005 12:38 pm
by timvw
man cron...
SYNOPSIS
crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }
crontab is the program used to install, deinstall or list the tables used to drive the cron(8) daemon in Vixie Cron. Each user can
have their own crontab, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly.
you could generate the file with php... and then pass that to the crontab binary.....
Posted: Tue Feb 22, 2005 5:33 pm
by pickle
If you want to do something hourly,daily,weekly or monthly, some (all?) installations of Linux also have cron.hourly/, cron.daily/, cron.weekly/, and cron.monthly/ directories in the /etc/ (or wherever crontab is found) directory. Simply dumping executable files in there will have them executed at the appropriate time. I find this much easier than goofing with crontab.
Posted: Fri Feb 25, 2005 6:26 pm
by Joe
pickle, is there no permission errors when 'dumping' files into the etc/cron.time directories?. If so, what are the chances of changing the permissions on a shared server.
Joe

Posted: Mon Feb 28, 2005 9:53 am
by pickle
I think all things in those cron folders is run as root, so there shouldn't be any permission errors other than possible problems with read-write-execute permissions.
Posted: Mon Feb 28, 2005 11:48 am
by AGISB
To run a cronjob on php scripts you need to compile php as cgi. Then you can easily call the script using cronjob