Professional Web Applications Themes

crontab manipulation from php - PHP Development

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 ...

  1. #1

    Default 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
    Arkascha Guest

  2. #2

    Default Re: crontab manipulation from php

    On Wed, 12 Nov 2003 20:39:12 +0100, Arkascha <nospamnospam.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 (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  3. #3

    Default Re: crontab manipulation from php

    >
    > 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 (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    > Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    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
    Arkascha Guest

Similar Threads

  1. scripting crontab entries
    By Peter Risdon in forum FreeBSD
    Replies: 1
    Last Post: February 16th, 01:55 PM
  2. Crontab
    By Antigoni in forum Linux / Unix Administration
    Replies: 2
    Last Post: June 4th, 12:15 PM
  3. What is wrong with this crontab?
    By Stephen Hooper in forum Linux / Unix Administration
    Replies: 4
    Last Post: August 6th, 05:11 AM
  4. crontab bug?
    By LeVA in forum Debian
    Replies: 1
    Last Post: August 4th, 12:10 AM
  5. changes to crontab not effective
    By Jochen Daum in forum Debian
    Replies: 2
    Last Post: July 14th, 12:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139