In some situations, it's convenient to create jobs that do their work, finish, and automatically reschedule themselves at some time in the future. Here's how to do this:
#!/bin/sh myself=/home/mikel/bin/restarter # Add any commands you want to do real work here ... sleep 60 at -s 0123 tomorrow $myself
Once you've started this script, it will run every day at 1:23 a.m. The sleep (40.2) makes sure that the following at command is executed after 1:23 a.m.; this guarantees that the next job will run at 1:23 a.m. tomorrow instead of 1:23 a.m. today. This trick isn't needed on most versions of at, but it isn't a bad idea.
Note that self-restarting jobs really are an artifact of an earlier era, when mortal users were supposed to stay away from the cron (40.12) facility. Now that users can have personal crontab files, the need for self-restarting jobs should diminish.
If you find that you do need to create scripts that reschedule themselves, please make sure to clean up after yourself! When your program is no longer needed, remember to delete it with atq and atrm (40.9).
-