kulls has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,
I want to run my shell script for daily basis. Due to holidays i can't able to run the script daily.So i wrote one infinite loop - perl script, that will run daily basis.If so called "Temporary cron".I have just pasted the code here. If you people have a better idea, please suggest me .
use strict; use warnings; my @date=split(" ",localtime()); my ($cur_date,$script_flag); $cur_date=$date[2]; while() { if($script_flag) { my $var = `echo RAJA`; print $var; } @date=split(" ",localtime()); if($date[2]==$cur_date) { $script_flag=1; $cur_date=$date[2]+ 1; } else { $script_flag=0; } exit if($cur_date > 31); # As i need only for 31st of this month }

Replies are listed 'Best First'.
Re: manual cron job
by Corion (Patriarch) on Jan 25, 2006 at 11:48 UTC

    Why are you not using cron? You seem to use some unixish programs, so cron should be available to you.

    If cron is no option, I found it convenient to more or less write my own crond in Perl by using Schedule::Cron - this has the advantage of still keeping all the configuration data more or less in crontab format. On Windows, I wrote Schedule::Cron::Nofork because the fork emulation stopped working (and forking) after three days or so, which was inconvenient.

      Sorry,
      Actually i'm running my script in server and i don't have a permission to run the cron job as well as installing any perl modules. Just timebeing , i'm utilizing my holodays through this script. If you can able to modify something, please suggest me.
      - kulls
        If you can install a .pl file, then you can also install a .pm, especially one that is pure perl. Do a search on this site on how to install a CPAN module in a custom directory.
        -imran
Re: manual cron job
by lima1 (Curate) on Jan 25, 2006 at 17:04 UTC
    this needs a lot of cpu time. if you are not allowed to use cronjobs, then i think the responsible person for that machine kills this job very soon. maybe add a sleep line....