Hello,
I want to setup a task to run on my pc (a hard disk SMART check, with email notification in case of error).
I set up a simple script to do that, and I want it to run once a week.
The problem is that the PC isn't always on. So I can't just setup a cron job, because there isn't a time when the pc will surely be switched on on a given day. (i.e. if I set the task to run, say, at 11am every Sunday, the pc might be off at that time next Sunday...)
I thought I might make a script to be run at boot, which checks a file that tells it when the next job was scheduled to occur; and if that time is passed, run the job and update the "next-run" file. This might work (if I can figure out how to work with dates within scripts) but it's not elegant. Is there a way to setup a cron job so that if that job should have occurred while the pc was off, then it is run at the next boot? I looked at the cron man page but couldn't find anything useful...
I want to setup a task to run on my pc (a hard disk SMART check, with email notification in case of error).
I set up a simple script to do that, and I want it to run once a week.
The problem is that the PC isn't always on. So I can't just setup a cron job, because there isn't a time when the pc will surely be switched on on a given day. (i.e. if I set the task to run, say, at 11am every Sunday, the pc might be off at that time next Sunday...)
I thought I might make a script to be run at boot, which checks a file that tells it when the next job was scheduled to occur; and if that time is passed, run the job and update the "next-run" file. This might work (if I can figure out how to work with dates within scripts) but it's not elegant. Is there a way to setup a cron job so that if that job should have occurred while the pc was off, then it is run at the next boot? I looked at the cron man page but couldn't find anything useful...
Comment