in reply to Exec'd perl running wild on cpu-time

If you want a script to run periodically, this is always a call for cron, the program that starts tasks under the several variants of Unix. Then you can do away with the while(1){} loop and let your program run just once every 5 minutes. If you are working under Win32, there is either the dreaded Scheduler service under Windows 9x (avoid it, it needs a person logged in), or the at service under NT, which has a different syntax but does what cron does under Unix.

Much more interesting though is, why your Perl program racks up that much CPU time at all, but I'm at a loss here.

  • Comment on Re: Exec'd perl running wild on cpu-time

Replies are listed 'Best First'.
RE: Re: Exec'd perl running wild on cpu-time
by jeroenes (Priest) on Nov 13, 2000 at 18:19 UTC
    Actually, I run the script continously. But, before finding the "open terminal" solution, I was thinking about making a cron job to periodically kill and restart the script. This way, I could get rid of the open terminal day and night and weekends...

    Indeed, I consider the CPU-black-holish thing puzzling. Maybe there is (and I hope so) a obvious/ stupid flaw in my way of handling the script.

      Of course, this is drifting away from Perl, but in the spirit of the Right Tool for The Right Job, cron knows all about weekdays and time slots. I would use cron (or at, which can do that stuff under NT) with the following crontab entry to ensure that it checks every 5 minutes during the week, from 7:00h to 20:00h, monday through friday :

      0,5,10,15,20,25,30,35,40,45,50,55 7-20 * * 1-5
      Note: I didn't check that line and also I only worked from the crontab (5) manpage. Usually this means that some tweaking is required afterwards.

        Instead of 0,5,10,15,20,25,30,35,40,45,50,55 you can also write */5 for every 5 minutes:
        */5 7-20 * * 1-5

        [ar0n]