Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!csn!spot.Colorado.EDU!frechett From: frechett@spot.Colorado.EDU (-=Runaway Daemon=-) Newsgroups: comp.unix.questions Subject: Re: Periodic execution of a program Message-ID: <1991Jan28.183256.4431@csn.org> Date: 28 Jan 91 18:32:56 GMT References: <5830@rex.cs.tulane.edu> <1991Jan28.153105.2996@mcs.drexel.edu> Sender: news@csn.org (news) Organization: University of Colorado, Boulder Lines: 46 Nntp-Posting-Host: spot.colorado.edu In article <1991Jan28.153105.2996@mcs.drexel.edu> udparmet@mcs.drexel.edu (Daniel J. Parmet) writes: >>I was wondering if it would be possible to execute at recursively, that is, >>have the file that at executes call at again to execute the same file at >>the same time the next day. I'm not sure if this would be possible. Just to be sure.. it does work and I am doing it now.. Right after this discussion started, I rushed out and looked at "at". Cron checks crontab every minute and in our crontab, it says to execute atrun at 00, 15, 30, and 45 minutes after the hour every hour. It is 00 and 30 on one of our other machines. Let me show you what I have running now. There are two files. cron123 and cron4 ---------cron123-------- CheckServ ---------end cron123---- ---------cron4--------- CheckServ set blue = `date +%H | awk '{print $1 + 1}'` if ( "$blue" == "24" ) set blue = 0 at ${blue}:00 /users/en-ecen/frechett/IRC/admin/cron123 at ${blue}:15 /users/en-ecen/frechett/IRC/admin/cron123 at ${blue}:30 /users/en-ecen/frechett/IRC/admin/cron123 at ${blue}:45 /users/en-ecen/frechett/IRC/admin/cron4 --------end cron4------- It is pretty self-explanitory but let me explain anyway. Lets say that it is 12:44 and I have nothing set up yet. All I have to do is: at 12:45 cron4 and it will put cron4 in /usr/spool/at/91.027.1245. at 12:45 cron does an atrun and atrun checks executes cron4. cron4 executes the command CheckServ (This checks to see if a server that I have is runing and if not, restarts it) and then it checks the current time and adds one hour to the hh in `date`. It then goes about setting up the files to execute for the next hour. It sets up cron123 for 1:00 1:15 1:30 and cron4 again at 1:45. The whole cylce is repeated every hour forever. (note, it does check to see if it is 23:45) This setup has been running for several days now...at least since I first saw a message mentioning "at". Hope someone can use this information. ian -- -=Runaway Daemon=-