Você pode querer usar o anacron.
De sua página de manual
NAME anacron - runs commands periodically SYNOPSIS anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [-S spooldir] [job] ... anacron [-S spooldir] -u [-t anacrontab] [job] ... anacron [-V|-h] anacron -T [-t anacrontab] DESCRIPTION Anacron can be used to execute commands periodically, with a frequency specified in days. Unlike cron(8), it does not assume that the machine is running continuously. Hence, it can be used on machines that aren't running 24 hours a day, to control daily, weekly, and monthly jobs that are usu‐ ally controlled by cron.
O howU da comunidade Ubuntu: link
Usando o anacron:
-
Basta colocar o arquivo de script executável em
/etc/cron.hourly
,/etc/cron.daily
,/etc/cron.weekly
ou/etc/cron.monthly
. -
Toque no arquivo de script:
sudo touch /etc/cron.daily/scriptfile
(
cron.daily
se for um trabalho diário).
Teste de anacron:
sudo anacron -f -d
-f Force execution of the jobs, ignoring the timestamps. -d Don’t fork to the background. In this mode, Anacron will output informational messages to standard error, as well as to syslog. The output of jobs is mailed as usual.
Mensagens anacron no log:
grep anacron /var/log/syslog
O anacron mantém os timestamps no /var/spool/anacron/
. Se você remover os arquivos cron.daily
, cron.weekly
ou cron.monthly
de lá, o anacron executará scripts diários, semanais ou mensais na próxima inicialização.