serial input _and_ time of day based tasks?

Discussion in 'Perl Misc' started by Stan Brown, Jun 24, 2003.

  1. Stan Brown

    Stan Brown Guest

    I've got a script that reads from a serial port, and blocks on that.

    Now I need to have it swap log files at midnight. I looked at Event.pm,
    but it seemed a bit overkill, and I could not see how to make time of day
    trigger it.

    What other choices might I consider?

    --
    "They that would give up essential liberty for temporary safety deserve
    neither liberty nor safety."
    -- Benjamin Franklin
     
    Stan Brown, Jun 24, 2003
    #1
    1. Advertising

  2. Hi,

    "Stan Brown" <> wrote in message
    news:bd9sge$nsa$...
    > Now I need to have it swap log files at midnight. I looked at Event.pm,
    > but it seemed a bit overkill, and I could not see how to make time of day
    > trigger it.
    >
    > What other choices might I consider?


    have a look at setitimer() in the Time::HiRes module
    which offers periodical SIGALRMs.

    HTH,

    Peter Dintelmann
     
    Peter Dintelmann, Jun 24, 2003
    #2
    1. Advertising

  3. Stan Brown

    Ted Zlatanov Guest

    On Tue, 24 Jun 2003, wrote:
    > I've got a script that reads from a serial port, and blocks on that.
    >
    > Now I need to have it swap log files at midnight. I looked at
    > Event.pm, but it seemed a bit overkill, and I could not see how to
    > make time of day trigger it.
    >
    > What other choices might I consider?


    Have cron run a second script (doesn't have to be Perl, e.g. kill or
    pkill will work) sending the primary script a USR1 signal at midnight.

    The primary script can be detected by the name (Proc::processTable,
    pkill) or by PID (write the PID to a file the secondary script will
    open).

    Then the primary script just has to catch a USR1 signal. Try not to
    do anything involved in the signal handler, best to only set a global
    $usr1caught variable and get out.

    Ted
     
    Ted Zlatanov, Jun 25, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael W. Cocke
    Replies:
    1
    Views:
    423
    Jim Gibson
    Oct 9, 2003
  2. Andrej Litowka

    Enviroment variable on Linux _and_ Windows

    Andrej Litowka, Sep 17, 2003, in forum: C Programming
    Replies:
    2
    Views:
    1,852
    Jack Klein
    Sep 18, 2003
  3. schwerdy
    Replies:
    2
    Views:
    350
    schwerdy
    Oct 27, 2003
  4. Chris Thomasson
    Replies:
    3
    Views:
    438
    Chris Thomasson
    Oct 22, 2007
  5. Andy
    Replies:
    1
    Views:
    736
Loading...

Share This Page