#!/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. Themakes 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 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.