View Full Version : Writing to cron via a script

11-25-2006, 09:14 PM
I'm writing a script to make it easier for me to update the cron file rather than having to use the annoying VI editor... but I can't figure out how to write to the cron file via a script?



11-28-2006, 12:45 PM
Though I have little specific knowledge in this area (in other words I'm talking out of my a*se) I wouldn't have thought you'd be able to, or even want to edit the cron file from php.
For security reasons on production servers, php would usually not be given access to files above the document root. Theoretically, some code injection could be used to wipe the hard drive.

Of course, anyone feel free to contradict.

You're using VI (which is terrible, I agree) to edit the cron file? Don't know about you but on my server I can call crontab -e to edit the list of cron jobs. But if you're running loads of jobs maybe that's no better.

You could always use cron to call a php script which controls other php scripts. For example keep in the database a list of files or functions to run, and call them from your controller file.