sing1ejack Posted February 21, 2007 Share Posted February 21, 2007 I have a script that gets the crontab info, makes changes, saves it in a temp file and updates crontab with it. exec("crontab -l", $crontab); << make changes to $crontab array >> << write array to tempfile.txt >> exec("crontab ".$filename); It works like a dream on the command line and fails completely when I try to run it from a webpage. Any idea why? Link to comment https://forums.phpfreaks.com/topic/39528-modifying-crontab-with-php/ Share on other sites More sharing options...
sing1ejack Posted February 26, 2007 Author Share Posted February 26, 2007 bump Link to comment https://forums.phpfreaks.com/topic/39528-modifying-crontab-with-php/#findComment-194367 Share on other sites More sharing options...
monk.e.boy Posted February 26, 2007 Share Posted February 26, 2007 when you run it from the command line you are root. When browse to it, apache is running the command, and apache does not have permission to update root's crontab. Try doing a: echo system('whoami'); There is a command to execute things as root (google for it) but i don't know how safe that'd be allowing apache to do root stuff. Be careful hope that helps monk.e.boy Link to comment https://forums.phpfreaks.com/topic/39528-modifying-crontab-with-php/#findComment-194395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.