#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Location
    Haarlem, The Netherlands
    Posts
    47
    Rep Power
    27
    Hi All,

    I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc??

    TIA,

    Dirk
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    Well if you're running it from the command prompt you can do it like this:
    perl /path/to/file.pl &

    the '&' will run it as a background process.

    To make the script figure out stuff and run the background take more work.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    You may need to check time of day within your code.

    #!/usr/bin/perl

    while (1)
    {
    ($second,$minute,$hour,$day,$month,$year,$week,$isdst) = localtime(time);

    if ($hour eq 9)
    {
    do something ...
    }

    sleep(3600);
    }

    exit(0);

    Then of course, run your program like the following:
    perl youfile.pl &



    [This message has been edited by Helicon (edited October 27, 2000).]
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    Can I just clarify, does background processing mean I could set a script off via Telnet using the above method and log out with the script continuing to run 24/7?

    Also, what does "sleep(3600);" mean?

    Sorry for the intrusion into the thread, but I think you just solved a few major headaches for me!

    Cheers
    Trev

IMN logo majestic logo threadwatch logo seochat tools logo