Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Writing to cron via a script
11-25-2006, 08:14 PM #1
- Join Date
- Apr 2004
- Thanked 1 Time in 1 Post
Writing to cron via a script
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, 11:45 AM #2
- Join Date
- May 2005
- Leeds, UK
- Thanked 0 Times in 0 Posts
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.