Page 1 of 1

how to program a crontab from a php script

Posted: Wed Oct 06, 2010 5:05 pm
by Aleale
Hi all!

I searched the forum for something similar but didn't find it.

I' d like to know if it's possible to modify a crontab (by adding or deleting a cron job) FROM a php page.

I have a cron job that read a specific php page at a specific time.
This page calculate how many new cron jobs have to be added the next day in order to cover all events.

Once executed, each cron job has to be deleted from the script launched by itself.

My website in hosted on a LAMP server to wich I can access cron by cpanel.
If I create a crontab on my user dir (immediately outside public_html) how can I force cron to use that one? And what about the previous crontab? Is it still executed or is totally substituted by the new one?

Shall I use a particular user to access cron? If so, how can I switch user from php?

thanks a lot, :)

Ale

Re: how to program a crontab from a php script

Posted: Wed Oct 06, 2010 11:36 pm
by requinix
First a quick question: Do you have full control over the server, or is this (eg) a shared hosting environment?

Re: how to program a crontab from a php script

Posted: Thu Oct 07, 2010 12:14 pm
by Aleale
Hi tasairis!

The server is shared with other sites. Actually I can program my own cron job using cpanel interface, so I think I have an user that can access cron.
But my experience with unix/linux is quite limited...

thanks in advance for your help,

Ale