#!/usr/local/bin/perl5 # Expects a file called get_at in the same directory # The format of this file is # mm/dd/yy hh:mm:ss # full path name of file # There is a space between the month/day/year and the hour:minute:second # and the leading # and spaces are not there - the first line begins # with a digit and the second line begins with /afs/nd.edu/ # The program mostly sleeps until the time indicated on the first line # and then it runs the progam specified on the second line. # Why not use the UNIX cron? Mostly because I can not get it to work # with afs permissions. # Just start run_at in the background # run_at & # and the program will be run more or less at the specified time. # The biggest worry is that if the machine on which you are running # is rebooted, the job will probably die and hence not get done. use strict; my(@lines,@lt,@tmp,@mdy,@hms,$run,$lrun); open(IN,"get_at") or die($!); @lines=; close(IN); chomp(@lines); @tmp=split(" ",$lines[0]); @mdy=split("/",$tmp[0]);$mdy[0]--;$mdy[2]+=100; @hms=split(":",$tmp[1]); $run=0; while($run==0) { $lrun=0; @lt=localtime(); if($mdy[2]>$lt[5]) {$run=1;} elsif($mdy[2]<$lt[5]) {$lrun=6;} elsif($mdy[0]>$lt[4]){$lrun=5;} elsif($mdy[1]<$lt[3]){$run=1;} elsif($mdy[1]>$lt[3]){$lrun=4;} elsif($hms[0]<$lt[2]){$run=1;} elsif($hms[0]>$lt[2]){$lrun=3;} elsif($hms[1]<$lt[1]){$run=1;} elsif($hms[1]>$lt[1]){$lrun=2;} elsif($hms[2]<$lt[0]){$run=1;} elsif($hms[2]>$lt[0]){$lrun=1;} if($run==0 && $lrun>1) {system( "sleep 60" );} } system( "date >> GOT" ); system( "echo $lines[1] >>GOT"); system( "echo @@@@@@@@@@@@@@@@@@@@@ >>GOT" ); system( $lines[1] );