473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

crontab manipulation from php

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
2 3522
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
>
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Bruno | last post by:
I set up a crontab using cpanel8 for the first time. It's just to run a very simple php script that sends an email and has one include() function. The first try at the crontab produced a...
3
by: Frank R. Suchy | last post by:
Hi, I want a php-script to maintain (some of) "my" cron jobs. Therefore it has to modify some crontab.txt (no problem) and has to execute crontab. But since php runs as the apache-user it...
3
by: rbt | last post by:
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to...
2
by: David Garamond | last post by:
I was thinking on how one would design an optimal (performance-wise) database of large number of schedules with crontab-like semantic. There will potentially be hundreds of thousands or even...
3
by: Sandman | last post by:
I have a PHP cli script, that backups my databases, using mysqldump via system(). When logged in with SSH, and launching the script with "./backup.php", all works just as it should, but when I...
4
by: Chr1s | last post by:
How do I execute a crontab command using php (not CLI) as user Joe? I don't have any problem getting output from commands such as 'ls' using passthru and exec but I am stumped with crontab. ...
2
by: martijn | last post by:
H! I have made a program that is checking if a program is running or not. If the program is not running then it must start the program again. in the /etc/crontab: * * * * ...
0
by: Martin Marcher | last post by:
Hello, is anyone aware of a crontab library. Possibly even more complete, something that will let me create/manipulate/delete crontab entries in a nice way and install the new crontab...
3
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.