As you already have a database, I would use several tables in that database to model the whole process:

  1. Submissions of new users go into the table new_users
  2. A script is triggered by cron every n minutes and checks whether there are entries in the table new_users. If so, it modifies the main users table according to the actions in new_users (insert,update,delete) and it also generates an generates an entry with the timestamp and ("regenerate","dhcpd.conf",Null) in the table jobs.
  3. Another script is triggered by cron every minute and checks whether there is a row dhcpd.conf,Null in jobs. If so, it regenerates dhcpd.conf and updates that row to "regenerate",dhcpd.conf,timestamp, and generates a new row in that table, "transfer","dhcpd.conf",Null
  4. Another script is also called by cron every minute that checks whether a transfer row is available in the database. It then executes the submitted transfer and updates the row.

This method has a latency of at least 1 minute per step involved, which should be small enough for adding new clients to dhcp, but which might not be enough for other tasks. There you could increase the polling frequency, but a hardcoded synchronized sequence via a shell script would most likely be better (combining all steps after the initial submission into one shell script).

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

In reply to Re: process syncronization by Corion
in thread process syncronization by bugsbunny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.