This will add a script that runs every day at 9:30 a.m.
exec('echo -e "`crontab -l`\n30 9 * * * /path/to/script" | crontab -');
You may have permission problems if you use this script from a web server. To get around this, I would suggest a different approach.
Here is one possible solution. Create a list of scripts to run. You can save this in a text file or in a database. Create a script to read this list and run it every minute or every 5 minutes (using cronjob). Your script should be smart enough to decide when to start the list of scripts and when to just exit.
Nick clark
source share