From 7695fce99922b91edac37ebf0a5b375b1db27fdd Mon Sep 17 00:00:00 2001 From: Matthias Lange Date: Wed, 4 Mar 2026 18:45:48 +0100 Subject: [PATCH] core::cronie: add sysvinit start script --- recipes/core/cronie.yaml | 7 ++++- recipes/core/cronie/S48cronie.sh | 53 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100755 recipes/core/cronie/S48cronie.sh diff --git a/recipes/core/cronie.yaml b/recipes/core/cronie.yaml index e973644a..bd203e17 100644 --- a/recipes/core/cronie.yaml +++ b/recipes/core/cronie.yaml @@ -1,7 +1,7 @@ # SUMMARY = "Cron daemon for executing programs at set times" # HOMEPAGE = "https://github.com/cronie-crond/cronie/" -inherit: [autotools] +inherit: [autotools, init] metaEnvironment: PKG_DESCRIPTION: "Cronie contains the standard UNIX daemon crond that runs @@ -23,5 +23,10 @@ buildScript: | autotoolsBuild $1 \ --prefix=/usr + # add init script + if initIsAnySysvinit; then + install -D -m 0755 $<@cronie/S48cronie.sh@> install/etc/init.d/S48cronie.sh + fi + packageScript: | autotoolsPackageTgt diff --git a/recipes/core/cronie/S48cronie.sh b/recipes/core/cronie/S48cronie.sh new file mode 100755 index 00000000..3fa2fe63 --- /dev/null +++ b/recipes/core/cronie/S48cronie.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Starts cronie (crond) daemon +# + +DAEMON="crond" +PIDFILE="/var/run/$DAEMON.pid" + +# shellcheck source=/dev/null +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" + +start() { + printf 'Starting %s: ' "$DAEMON" + # shellcheck disable=SC2086 # we need the word splitting + start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf 'Stopping %s: ' "$DAEMON" + start-stop-daemon -K -q -p "$PIDFILE" + status=$? + if [ "$status" -eq 0 ]; then + rm -f "$PIDFILE" + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart) + "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac