473,608 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3537
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
processcollect s 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
2040
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 permission denied result. I gave it the proper permissions and on the second try, the results say that there is no such file but it also shows some of the php code and says "syntax error near unexpected token" This script works perfectly fine when...
3
5355
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 cannot run "my" crontab. In general: Can a php-script run an external program under a different
3
5393
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 work across Linux and BSD systems. Any pointers?
2
8421
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 millions of "crontab" entries, and there will be a query run once every minute to determine which entries are to be run for that minute. The primary goal is, of course, for the query to run as fast as possible. My first stab is, straightforward...
3
3375
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 put it in a crontab: 00 2 * * * /home/sandman/bin/backup.php I get a mail that says:
4
3966
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. Many thanks! Chris
2
3870
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: * * * * * root /usr/sbin/ program_prgchk in the /usr/sbin/program_prgchk:
0
1345
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 accordingly. I had a look at the crontab docs and never realized how complex it actually is. So before I spend time in creating such a thing maybe
3
9592
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 crontab it is working properly when i try to run the shell script or even echo " name" cant to be worked using crontab. can you please help me out for this problem?
0
8050
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7987
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8472
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8130
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6805
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3954
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1318
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.