Re: [PHP] Executing CRON from a WebForm..
At 22:52 14-11-2003, you wrote: Hi!!. I'm trying to give users the chance to modify its cron from a webform. The webform let's the users choose the day, month and minutes after hour, then, using PHP I made one long string and save it into a file ($tmpnam), it looks like this: $content = $min $hour $day * * /tmp/parse_maillog.sh; //I obtain $min $hour $day earlier in my webform $tmpfname = tempnam (/tmp/mail, $username_crontab.txt); $handle = fopen($tmpfname, w); fwrite($handle, $content); fclose($handle); system(crontab -u $username $username_crontab.txt); unlink($tmpfname); Debugging this part I found that the file is OK, the problem is with the system function, obviously a user problem, how can I fix it?? any ideas?? I use phpSecurePages as an authentication system. You forgot to tell what the problem is. Does the crontab command work when you try to parse it directly? Wasn't there something in the manual about using `bacticks` instead of quotes with the system command? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Executing CRON from a WebForm..
Sorry. The problem is that I cannot get the crontab command executed. I did try with the backsticks, but it didn't work either. I have different users, login in to the website using phpSecurePages, how can I let them change their crontab? Is my approach too wrong?? Any ideas?? Thanx.. On Fri, 2003-11-14 at 16:06, Chris Hayes wrote: At 22:52 14-11-2003, you wrote: Hi!!. I'm trying to give users the chance to modify its cron from a webform. The webform let's the users choose the day, month and minutes after hour, then, using PHP I made one long string and save it into a file ($tmpnam), it looks like this: $content = $min $hour $day * * /tmp/parse_maillog.sh; //I obtain $min $hour $day earlier in my webform $tmpfname = tempnam (/tmp/mail, $username_crontab.txt); $handle = fopen($tmpfname, w); fwrite($handle, $content); fclose($handle); system(crontab -u $username $username_crontab.txt); unlink($tmpfname); Debugging this part I found that the file is OK, the problem is with the system function, obviously a user problem, how can I fix it?? any ideas?? I use phpSecurePages as an authentication system. You forgot to tell what the problem is. Does the crontab command work when you try to parse it directly? Wasn't there something in the manual about using `bacticks` instead of quotes with the system command? -- The explanation requiring the fewest assumptions is the most likely to be correct. -- William of Occam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Executing CRON from a WebForm..
Hi, reply without trying your code: You might need suexec to achieve this, else i don't belive one user can set the cron jobs for another user. Remember apache is usually running as a non privileged user. Andres Villalobos Camacho wrote: Sorry. The problem is that I cannot get the crontab command executed. I did try with the backsticks, but it didn't work either. I have different users, login in to the website using phpSecurePages, how can I let them change their crontab? Is my approach too wrong?? Any ideas?? Thanx.. On Fri, 2003-11-14 at 16:06, Chris Hayes wrote: At 22:52 14-11-2003, you wrote: Hi!!. I'm trying to give users the chance to modify its cron from a webform. The webform let's the users choose the day, month and minutes after hour, then, using PHP I made one long string and save it into a file ($tmpnam), it looks like this: $content = $min $hour $day * * /tmp/parse_maillog.sh; //I obtain $min $hour $day earlier in my webform $tmpfname = tempnam (/tmp/mail, $username_crontab.txt); $handle = fopen($tmpfname, w); fwrite($handle, $content); fclose($handle); system(crontab -u $username $username_crontab.txt); unlink($tmpfname); Debugging this part I found that the file is OK, the problem is with the system function, obviously a user problem, how can I fix it?? any ideas?? I use phpSecurePages as an authentication system. You forgot to tell what the problem is. Does the crontab command work when you try to parse it directly? Wasn't there something in the manual about using `bacticks` instead of quotes with the system command? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php