Frequently within my scripts I schedule auxiliary tasks for later in the form:
at now + 8 hours <<< "rm -f workfile.$$ >> $worklog 2>&1 "
or
at 11pm + $(date +%M) minutes <<< "./postMarketJob.sh $orderID &> $orderID.log"
Trouble is, sometimes the laptops or PCs I use as servers are off when the scheduled time comes, so the at job never happens.
Same issue is true of crontab entries.
I'm trying to make sense of anacron's man page for Ubuntu.
Is there a tool to schedule a job such that it will run when requested, or at the earliest possibility whenever the server is back online?
It doesn't have to be with anacron
, and if it's something only root can use, then I'll just wrap my invocations with sudo
CLARIFICATION
The tasks are not some fixed scripts (if at all) but very variable, and are conditional, meaning that depending on the unforeseen state of things within programs, they may or must not be scheduled in the first place.
It sounds like I might have to develop my own wrapper on top of atd/anacron that gives my programs a similar interface to at
, but I was hoping something already exists. Been checking if fcron
fits the bill and if available for Ubuntu in some repo.