By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

crontab manipulation from php

P: n/a
Maybe someone can give me a short help with this...

I got a server application in a LAMP environment doing batch tasks. A
cronjob serves as a regular trigger, a metronom. The trigged
processcollects a number of pending jobs to be run and typically creates a
number of additional jobs to be run in future. The type of created jobs,
their parameters and everything can be configured in the application.
Fine...
In addition I'd like to configure and control the triggering cron job itself
from within the application. Since the web server must not restart the cron
job I can't simply rewrite the crontab. The changes would only become
active after the next reboot, probably some three years in the future
(LAMP :-) ).
What has to be done is to manipulate the crontab of the web server in a way
that the crontab rereads this craontab. crontab -e does exactly this, upon
storing the file the crontab is triggered to read it. However the commmand
requires an editor as argument, this editor is used for the manipulation.
Now I don't really want to control some editor.
I guess I have to specify some process as 'editor' that has access to the
application settings and can open the file. Looks like a lynx or wget call
to a php url, the script should use fopen to open the crontab...

Maybe someone has a better idea or even a solution?
Thanx to all!

--
arkascha
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 12 Nov 2003 20:39:12 +0100, Arkascha <no****@nospam.com> wrote:
I got a server application in a LAMP environment doing batch tasks. A
cronjob serves as a regular trigger, a metronom. The trigged
processcollects a number of pending jobs to be run and typically creates a
number of additional jobs to be run in future. The type of created jobs,
their parameters and everything can be configured in the application.
Fine...
In addition I'd like to configure and control the triggering cron job itself
from within the application. Since the web server must not restart the cron
job I can't simply rewrite the crontab. The changes would only become
active after the next reboot, probably some three years in the future
(LAMP :-) ).
What has to be done is to manipulate the crontab of the web server in a way
that the crontab rereads this craontab. crontab -e does exactly this, upon
storing the file the crontab is triggered to read it. However the commmand
requires an editor as argument, this editor is used for the manipulation.
Now I don't really want to control some editor.
I guess I have to specify some process as 'editor' that has access to the
application settings and can open the file. Looks like a lynx or wget call
to a php url, the script should use fopen to open the crontab...

Maybe someone has a better idea or even a solution?


Writing to a file and issuing 'crontab file_containing_new_info' will update
the crontab. You don't need to restart crond for it to pick up changes,
wouldn't be much good if you did.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2

P: n/a
>
Writing to a file and issuing 'crontab file_containing_new_info' will
update
the crontab. You don't need to restart crond for it to pick up changes,
wouldn't be much good if you did.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


Hm,
for me this is one of these situations where you ask yourself:
how the f*** can it be that you did not see that yourself?
You work with that stuff day after day, you help people all over the world
with their problems, but you can't really read whats written in a
manpage...
Thanx Andy, good night and I promise to be a good boy next time ;-)

--
arkascha
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.