[Yum-devel] [PATCH] Fix yum-cron service file for systemd, add conversion code.

James Antill james at and.org
Wed Feb 6 21:46:36 UTC 2013


---
 yum-cron/yum-cron.service |    3 ++-
 yum.spec                  |   10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/yum-cron/yum-cron.service b/yum-cron/yum-cron.service
index 534d9b0..82f3e6b 100644
--- a/yum-cron/yum-cron.service
+++ b/yum-cron/yum-cron.service
@@ -2,7 +2,8 @@
 Description=Run automatic yum updates as a cron job
 
 [Service]
-Type=simple
+Type=oneshot
+RemainAfterExit=yes
 ExecStart=/bin/touch /var/lock/subsys/yum-cron
 ExecStop=/bin/rm -f /var/lock/subsys/yum-cron
 
diff --git a/yum.spec b/yum.spec
index bad42d1..26eec65 100644
--- a/yum.spec
+++ b/yum.spec
@@ -201,6 +201,16 @@ exit 0
 %post cron
 %systemd_post yum-cron.service
 
+#  Note that systemctl preset is being run here ... but _only_ on initial
+# install. So try this...
+
+if [ -f /var/lock/subsys/yum-cron -a -f /etc/rc.d/init.d/yum-cron ]; then
+ systemctl enable yum-cron
+fi
+
+# Also note:
+#  systemctl list-unit-files | fgrep yum-cron
+
 %preun cron
 %systemd_preun yum-cron.service
 
-- 
1.7.6.5



More information about the Yum-devel mailing list