I wan to run a backup script once per day but I don't want to specify a certain time, just once per day. I've read that the @daily cron attribute runs every day at 00:00 but i don't know if the receiving server will be up at this time.
Is it possible to configure cron
to run this script just once per day irrespective of the time? Or run the script until it succeeds and then try again the next day?
@reboot would be an option however the sending end might reboot several times per day in which case it would lead to unnecessary backups.
You may want to use the anacron.
From its man page
The Ubuntu community HowTo: https://help.ubuntu.com/community/CronHowto
Using anacron:
Simply put the executable script file in the
/etc/cron.hourly
,/etc/cron.daily
,/etc/cron.weekly
or/etc/cron.monthly
.Touch the script file:
(
cron.daily
if it is a daily job).Testing anacron:
Anacron messages in the log:
Anacron keeps timestamps in the
/var/spool/anacron/
. If you removecron.daily
,cron.weekly
orcron.monthly
files from there, anacron will execute daily, weekly or monthly scripts at the next startup.Use @daily as you are, but add @reboot as well. @reboot will run the script when you boot.
See Ubuntu wiki cron for additional information.