in reply to Running a perl script automatically on Mac OS X 10.5

Not only is cron your friend in the Unix world, there is also the at command. The 'at' command allows you to schedule a command to run once. An at man page is here.
  • Comment on Re: Running a perl script automatically on Mac OS X 10.5

Replies are listed 'Best First'.
Re^2: Running a perl script automatically on Mac OS X 10.5
by Illuminatus (Curate) on Sep 05, 2008 at 18:22 UTC
    The 'at' command has the added advantage over cron that it is not tied to a specific instant of time. If you schedule a job to run in 'cron' to run at 1pm every day, and the system happens to be down at 1pm, the job will not run until 1pm the next day. With 'at', if you schedule the job to run at 1pm, and the system is down until 2pm, then when it comes up at 2pm, the job will run then.

    Of course, you have to add extra logic to have it re-schedule itself if it is a periodic job.

Re^2: Running a perl script automatically on Mac OS X 10.5
by blazar (Canon) on Sep 13, 2008 at 11:20 UTC
    Not only is cron your friend in the Unix world, there is also the at command.

    For completeness, it has to be said that at used to rely on an atrun command scheduled to run under cron every ten minutes, IIRC: in modern implementations it is based on an atd daemon itself instead, and atrun is a convenient script left there for compatibility.

    More interestingly, it has to be said that PC's as commonly used tend not to be turned on 24/7, and thus cron (or whatever) scheduling should be tailored on the user's habits. Alternatively, I know there to exist an anacron utility, which:

    is a computer program that performs periodic command scheduling which is traditionally done by cron, but without assuming that the system is running continuously. Thus, it can be used to control the execution of daily, weekly, and monthly jobs (or anything with a period of n days), on systems that don't run 24 hours a day. Anacron was originally conceived and implemented by Christian Schwarz in Perl, for the Unix operating system. The current implementation, in C, was written by Itai Tzur and is actively maintained by Sean 'Shaleh' Perry.

    Unfortunately, AIUI it is not much known nor used, especially by major Linux distros, which often schedule "housekeeping" operations at times at which the computer will likely be off, instead. Incidentally and in the same vein as above, anacron is not a daemon but must be scheduled with cron - a design which I personally find entirely reasonable.

    (Sorry for replying so late!)

    --
    If you can't understand the incipit, then please check the IPB Campaign.