I have a script (backup.sh) to backup some files:
#!/bin/sh
LOGFILE="/home/adrian/scripts/backup/backup.log"
echo "*********************************************" >> "$LOGFILE"
echo "** Backup: "$(date)" **" >> "$LOGFILE"
echo "*********************************************" >> "$LOGFILE"
echo "*** work: Documents ***" >> "$LOGFILE"
rsync -r -t -v --progress --delete -s /work/Documents /backup/Backup/work >> "$LOGFILE" 2>&1
echo "*** work: Configurations ***" >> "$LOGFILE"
rsync -r -t -v --progress --delete -s /work/Configurations /backup/Backup/work >> "$LOGFILE" 2>&1
echo "*** work: Development ***" >> "$LOGFILE"
rsync -r -t -v --progress --delete -s /work/Development /backup/Backup/work >> "$LOGFILE" 2>&1
echo "*** openSuse: backup script ***" >> "$LOGFILE"
rsync -r -t -v --progress -s /home/adrian/scripts/backup/backup.sh /backup/Backup/ >> "$LOGFILE" 2>&1
echo "*** Backup finished at $(date) with exit code $? ***" >> "$LOGFILE"
This file is in /etc/cron.weekly:
adrian@stroustrup:/etc/cron.weekly> ls -l
total 4
-rwxr-xr-x. 1 root root 902 Jul 10 18:42 backup.sh
The anacron configuration file is:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
The status of cron is:
adrian@stroustrup:~> sudo systemctl status cron
● cron.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/cron.service; enabled; preset: enabled)
Active: active (running) since Fri 2026-07-10 12:21:36 -03; 7h ago
Invocation: 73af714c9b094706bb01fd3609f008bc
Main PID: 1564 (cron)
Tasks: 1
CPU: 165ms
CGroup: /system.slice/cron.service
└─1564 /usr/sbin/cron -n
Jul 10 13:36:00 stroustrup anacron[7502]: Job `cron.daily' started
Jul 10 13:36:00 stroustrup anacron[7502]: Job `cron.daily' terminated
Jul 10 13:56:00 stroustrup anacron[7502]: Job `cron.weekly' started
Jul 10 13:56:00 stroustrup anacron[7502]: Job `cron.weekly' terminated
Jul 10 13:56:00 stroustrup anacron[7502]: Normal exit (2 jobs run)
Jul 10 16:00:00 stroustrup CRON[14403]: (root) CMD (run-parts /etc/cron.hourly)
Jul 10 16:00:00 stroustrup CRON[14402]: (root) CMDEND (run-parts /etc/cron.hourly)
Jul 10 17:00:00 stroustrup CRON[18455]: (root) CMD (run-parts /etc/cron.hourly)
Jul 10 18:00:00 stroustrup CRON[25928]: (root) CMD (run-parts /etc/cron.hourly)
Jul 10 19:00:00 stroustrup CRON[28084]: (root) CMD (run-parts /etc/cron.hourly)
adrian@stroustrup:~>
But, the script doesn’t run!
If I force anacron:
adrian@stroustrup:~> sudo anacron -f -d cron.weekly
[sudo] password for adrian:
Anacron started on 2026-07-10
Will run job `cron.weekly' in 44 min.
Job `cron.weekly' started
Job `cron.weekly' terminated
Normal exit (1 job run)
but the script is not executed.
(The script is working: If I run it manually, it works!)
Do you hava any idea?
Thank you, in advance!