Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion recipes/core/cronie.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
53 changes: 53 additions & 0 deletions recipes/core/cronie/S48cronie.sh
Original file line number Diff line number Diff line change
@@ -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