[systemd-devel] Enable a cron with systemd
Steve Traylen
steve.traylen at cern.ch
Sun Feb 5 04:58:36 PST 2012
Hi,
I was looking migrating one fedora package, fetch-crl to systemd. It
is similar situation
also for yum-cron.
The aim is to have a cron installed but that it only does something if
a particular service
is started.
Currently the methods of the init.d script does
start , touch /var/lock/subsys/fetch-crl-cron
stop , rm -f /var/lock/subsys/fetch-crl-cron
status , check if /var/lock/subsys/fetch-crl-cron exists
and the then the cron job starts with
if [ -f /var/lock/subsys/fetch-crl-cron ] ; then
do something
else
exit
fi
The reason for this is for instance you don't want to run the cron job
with no network
in single user mode for instance.
So I can replicate this to some extent with
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/touch /var/lock/subsys/fetch-crl-cron
ExecStop=/bin/rm -f /var/lock/subsys/fetch-crl-cron
but this is rubbish in particular status is not correct if that file
is deleted for
some reason. I could not see a way to add an ExecStatus command?
But more over I am probably going about this all wrong? I guess I want
an "empty"
service and then have the cron job query that directly. Or there is
some other systemd
magic I am unaware of.
Any suggestion as to what to do here.
Steve.
--
Steve Traylen
More information about the systemd-devel
mailing list