crontab
as any other whatever scheduler or whatever can't work when the computer is off.
cron is a unix, utility that allows tasks to be automatically run in
the background at regular intervals by the cron daemon. These tasks
are often termed as cron jobs in unix . Crontab (CRON Table) is a
file which contains the schedule of cron entries to be run and at
specified times.
So run cron run the command
crontab -e
will open the cron file in your default editor.
Add the entry of your scheduled command
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
So now for your question, suppose I have this cron entry:
30 23 31 5 * apt-get install foo
This I want to install the foo
package in 31-5-2015 at 23:30
So what happen if the computer was off at this time
in simple words, the cron is not executed and will never be executed at all
Now suppose I have this cron entry:
30 23 * 5 * apt-get install foo
This I want to install the foo
package in any day of month 5-2015 at 23:30
So what happen if the computer was off at this time
in simple words, the cron is not executed, but you still have some opportunity to run in any day of Month 5 this year at the time 23:30.
As a conclusion
The cron will not just return to complete if the PC was off by the time it had to be run, instead it will execute at the specific time in your crontab entries.