Results 1 to 1 of 1
Hi all:
I have an expect script that I need to run from crontab. I have a browser based frontend for this script that I created using PHP. One of ...
- 06-23-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 3
PHP, Expect, Crontab and Permissions
Hi all:
I have an expect script that I need to run from crontab. I have a browser based frontend for this script that I created using PHP. One of the many functions that this frontend does is I can set a cron job for my script. So, I put in the times I want the script to run and when I submit the form, php edits a "schedule.cron" file and then I use exec('crontab schedule.cron'); to add it to cron. This crontab does not run perhaps because it is set under user www-data and it does not have the proper permissions. After searching the web, decided to wrap my expect script in a c program, setuid the c binary to run as root. I also edited the sudoers file so that I can run exec('sudo crontab schedule.cron') from php. The end result is this:
I create a cron job under root to run my c binary.
When the c binary runs, it runs as root.
Still my script is not running when I set it from the web frontend. Whenever I do it from the command line, it runs just fine. Can anybody help me?


Reply With Quote