On 2/9/24 10:56, Carlos E. R. wrote:
On
2024-02-09 09:10, Marc Chamberlin via openSUSE Users wrote:
I ran into a problem in OpenSuSE 15.5
trying to start the cron.service daemon. It failed because the
directory at /etc/cron.d was empty (which in previous releases
of OpenSuSE it was not empty). The cron.service file, as
supplied from the installation repos,
This phrase makes people think that you installed cron.service
manually "somehow", that it is not the default installed file.
So, what is the full path of that "cron.service" file?
Assuming that it is "/usr/lib/systemd/system/cron.service", then
please do:
rpm -qf /usr/lib/systemd/system/cron.service
rpm -qfi /usr/lib/systemd/system/cron.service
systemctl cat cron.service
And paste it all into your reply here. Complete, including the
initial command prompt, like:
cer@Telcontar:~> rpm -qf /usr/lib/systemd/system/cron.service
cronie-1.5.7-150400.84.3.1.x86_64
cer@Telcontar:~>
Carlos, can do, with a bit more info and explanation...
wa7pxw:/usr/lib/systemd/system # rpm -qf
/usr/lib/systemd/system/cron.service
cronie-1.5.7-150400.84.3.1.x86_64
wa7pxw:/usr/lib/systemd/system # rpm -qfi
/usr/lib/systemd/system/cron.service
Name : cronie
Version : 1.5.7
Release : 150400.84.3.1
Architecture: x86_64
Install Date: Mon 11 Dec 2023 07:17:38 AM PST
Group : System/Daemons
Size : 321186
License : BSD-3-Clause AND GPL-2.0-only AND MIT
Signature : RSA/SHA256, Wed 18 Jan 2023 01:39:12 AM PST, Key ID
70af9e8139db7c82
Source RPM : cronie-1.5.7-150400.84.3.1.src.rpm
Build Date : Wed 18 Jan 2023 01:38:41 AM PST
Build Host : sheep52
Relocations : (not relocatable)
Packager : https://www.suse.com/
Vendor : SUSE LLC <https://www.suse.com/>
URL : https://github.com/cronie-crond/cronie
Summary : Cron Daemon
Description :
cron automatically starts programs at specific times. Add new
entries
with "crontab -e". (See "man 5 crontab" and "man 1 crontab" for
documentation.)
Under /etc, find the directories cron.hourly, cron.daily,
cron.weekly,
and cron.monthly. Scripts and programs that are located there are
started automatically.
Distribution: SUSE Linux Enterprise 15
----
Ok, this next bit that you asked for is showing the version of
/etc/systemd/system/cron.service that I created in order to correct
the version that was in /usr/lib/systemd/system/cron.service. My
modus operandi is that if I have to modify a .service file, I leave
the original in /usr/lib/systemd/system and put the modified version
in /etc/systemd/system Empirical observations tell me that anything
in /etc/systemd/system takes precedence over anything in
/usr/lib/systemd/system. I will show the version found at
/usr/lib/systemd/system/cron.service below this output -
---
wa7pxw:/usr/lib/systemd/system # systemctl cat cron.service
# Warning: cron.service changed on disk, the version systemd has
loaded is outdated.
# This output shows the current version of the unit's original
fragment and drop-in files.
# If fragments or drop-ins were added or removed, they are not
properly reflected in this output.
# Run 'systemctl daemon-reload' to reload units.
# /etc/systemd/system/cron.service
[Unit]
Description=Command Scheduler
After=nss-user-lookup.target network.target time-sync.target
After=postfix.service sendmail.service exim.service
[Service]
# ExecStartPre=+/bin/sh -c '/bin/chmod -R 0744 /etc/cron.*'
ExecStartPre=+/bin/sh -c '/bin/chmod 0744 /etc/cron.*'
ExecStartPre=+/bin/sh -c '/bin/chmod -R 0744 /etc/cron.*/*'
# Only do the following ExecStartPre if there is something in
/etc/cron.d
# ExecStartPre=+/bin/sh -c '/bin/chmod -R 0644 /etc/cron.d/*'
ExecStartPre=+/bin/chmod 0644 /etc/crontab
ExecStart=/usr/sbin/cron -n
ExecReload=/usr/bin/kill -s SIGHUP $MAINPID
Restart=on-abort
KillMode=process
TasksMax=infinity
[Install]
WantedBy=multi-user.target
---
wa7pxw:/usr/lib/systemd/system
#
cat cron.service
[Unit]
Description=Command Scheduler
After=nss-user-lookup.target network.target time-sync.target
After=postfix.service sendmail.service exim.service
[Service]
ExecStartPre=+/bin/sh -c '/bin/chmod -R 0744 /etc/cron.*'
# Only do the following ExecStartPre if there is something in
/etc/cron.d
ExecStartPre=+/bin/sh -c '/bin/chmod -R 0644 /etc/cron.d/*'
ExecStartPre=+/bin/chmod 0644 /etc/crontab
ExecStart=/usr/sbin/cron -n
ExecReload=/usr/bin/kill -s SIGHUP $MAINPID
Restart=on-abort
KillMode=process
TasksMax=infinity
[Install]
WantedBy=multi-user.target
---
I checked back on other systems running OpenSuSE x64 - 15.4, 15.3,
15.2, and 15.0 and found that the version of cron.service in
/usr/lib/systemd/system were all identical. So if this is a change
that I or one of my co-workers made, then it was done years ago and
forgotten about. I can't say nor can I understand how it has
propagated through so many upgrades. (some of which I am pretty sure
were done as a new installation from a DVD disk, not as an
"in-place" upgrade from a previous version)