Leap 16 and cron

Hi,
since my update to Leap 16 my weekly cronjobs placed in /etc/cron.weekly are not executed any more. The cron service is running, but nothing happens.

I used standard Leap 15.x mechanism to execute crons by /var/spool/cron/lastrun/cron.weekly

I now read that cron is old way of doing and a better solution is timer units with systemd.

So, is cron still working but needs to be configured different on Leap 16 or is it better to move to systemd?
Any hint ?

Thank you!

As far as I know, systemd simply interprets the cron configurations. But I vaguely remember that there was another thread about problems with daily and/or weekly runs. Try to search for it.

@sirtoby:

Helping Henk with his memory –

Also, these URLs –

1 Like

Show

cat /etc/crontab
ls -lZ /etc/crontab
ls -lRZ /etc/cron.weekly

That is wrong.

linux:~ # cat /etc/crontab
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
@hourly         root      run-parts /etc/cron.hourly
@daily          root      run-parts /etc/cron.daily
@weekly         root      run-parts /etc/cron.weekly
@monthly        root      run-parts /etc/cron.monthly
linux:~ # ls -lZ /etc/crontab
-rw------- 1 root root ? 720 Jul  9  2024 /etc/crontab


linux:~ # ls -lRZ /etc/cron.weekly
/etc/cron.weekly:
total 32
-rwxrwxr-x 1 st  users ?  902 Aug 12  2018 1-backup.sh
-rwxrwxr-x 1 st  users ? 1627 Oct 20 17:01 2-backup.sh
-rwxrwxr-x 1 st  users ? 1132 Aug 19  2018 3-backup.sh
-rwxr-xr-x 1 st  users ?  967 Aug 12  2018 4-backup.sh
-rwxr-xr-x 1 st  users ?  725 Aug 12  2018 5-backup.sh
-rwxr-xr-x 1 st  users ?  740 Aug 12  2018 6-backup.sh
-rwxr-xr-x 1 st  users ?  344 Aug 11  2017 7-journal-vacuum.sh
-rwxr-xr-x 1 root root  ?  354 Aug 11  2019 8-empty-tmp.sh
linux:~ # ls -lZ /var/spool/cron/lastrun/cron.weekly
-rw-r--r-- 1 root root ? 0 Sep 28 02:15 /var/spool/cron/lastrun/cron.weekly

SUSE switched to using run-parts and by default it ignores files with . in the name. See man run-parts.

You can always manually test what happens

run-parts --test --debug /etc/cron.weekly
1 Like

@sirtoby:

Also, please check the differences between /etc/sysconfig/cron and /usr/share/fillup-templates/sysconfig.cron …

  • The upgraded “cronie” package had possibly not updated the cron configuration in /etc/ correctly …
1 Like

Thank you I changed that. They seem now to be executed by run-parts

I copied one in cron.hourly and cron.daily to check what will happen.

Thank you.
The files seem to be the same.
In /etc/sysconfig/cron there are only two additional lines for logging

@arvidjaar
The cron.hourly was now executed with the file without . and extension.
I will wait now the daily and check again the weekly.
But for the moment it looks like the run-parts did the magic…
Thank you!

https://bugzilla.suse.com/show_bug.cgi?id=1252355

1 Like

@arvidjaar
the daily was executed as well.
So I guess the weekly will work as well.
Thank you for your support!

Hmm.
Why should test and debug in crontab?
Use “man run-parts”.