0logwatch cron script seems to point to /usr/sbin/logwatch however in newer EL versions sbindir in RPM spec files points to /usr/bin and logwatch executable is installed there.
This has resulted in a broken daily script on AlmaLinux 9.7
/etc/cron.daily/0logwatch:
LOGWATCH_SCRIPT="/usr/sbin/logwatch"
Actual path:
/usr/bin/logwatch
So maybe sed the path in 0logwatch replacing the path with sbindir variable during build.
Just manually ran sed to get things working again:
sed -i 's/LOGWATCH_SCRIPT="\/usr\/sbin\/logwatch"/LOGWATCH_SCRIPT="\/usr\/bin\/logwatch"/' /etc/cron.daily/0logwatch
If RHEL 9.x+ and children have changed the path of the logwatch script in the rpm spec (which is normally a symlink in any case) from sbin to bin, then whatever solution also needs handle all instances of the path….
A simple grep shows we have 4 files which have the hardcoded /usr/sbin/logwatch
README:ln -s /usr/share/logwatch/scripts/logwatch.pl /usr/sbin/logwatch
install_logwatch.sh:ln -f -s $BASEDIR/scripts/logwatch.pl /usr/sbin/logwatch
install_logwatch.sh:printf "Created symlink for /usr/sbin/logwatch \n"
scheduler/logwatch.service:ExecStart=/usr/sbin/logwatch $LOGWATCH_OPTIONS
scheduler/logwatch.cron:LOGWATCH_SCRIPT="/usr/sbin/logwatch”
-Mike
Related
Bugs: #127
I believe this is related/similar so replying here vs. creating a new bug.
First install of v7.14 on a (new) RockyLinux 9.7 VM yesterday and received this error overnight:
/etc/cron.daily/0logwatch: line 14: /usr/sbin/logwatch: No such file or directoryConfirmed the file was missing:
On other RL8/RL9 installs using prior versions (both v7.9 and v7.13), this appears to be a link:
Confirmed the file still exists where expected:
So I created the link:
Waiting to see what happens overnight tonight...
There appears to be a push among some distributions/packages to move to /usr/bin, and eventually remove /usr/sbin.
So my inclination would be to change all references and installation of logwatch to /usr/bin. In both the logwatch.spec and install_logwatch.sh file, we can test if the /usr/sbin directory exists. If so, then add a symbolic link from /usr/sbin/logwatch to /usr/bin/logwatch, for those that have hard-coded the path in their own scripts.
That's not the end of the story, however. Some of the service scripts look for hard-coded paths that may include /usr/sbin, /sbin, and /usr/local/sbin (for other, non-logwatch executables). If those executable paths change (which can be distribution-specific), then we might need to make further changes.
Pushed change to /usr/bin rather than /usr/sbin as executable for logwatch (which is a symbolic link to the /usr/share/logwatch/scripts/logwatch.pl script).
Does not delete any links under /usr/sbin/logwatch. For existing systems, the old link continues to work. For new installations, only the new /usr/bin/logwatch link will work.
Also deleted the requirement for
crontabspackage, as newer installations may use alternate scheduling tools (most notably systemd timers).