diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-apps/watchdog/files/watchdog-init.d |
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-apps/watchdog/files/watchdog-init.d')
-rw-r--r-- | sys-apps/watchdog/files/watchdog-init.d | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sys-apps/watchdog/files/watchdog-init.d b/sys-apps/watchdog/files/watchdog-init.d new file mode 100644 index 000000000000..734a02cdbcbe --- /dev/null +++ b/sys-apps/watchdog/files/watchdog-init.d @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount + use logger +} + +get_config() { + set -- ${WATCHDOG_OPTS} + while [ -n "$1" ] ; do + if [ "$1" = "-c" -o "$1" = "--config-file" ] ; then + echo $2 + return + fi + shift + done + echo /etc/watchdog.conf +} + +get_delay() { + # man this is fugly + sed -n \ + -e '1{x;s:.*:10:;x}' \ + -e 's:#.*::' \ + -e 's:^[[:space:]]*::' \ + -e '/^interval/{s:.*=::;h}' \ + -e '${g;p}' \ + $(get_config) +} + +start() { + ebegin "Starting watchdog" + start-stop-daemon --start \ + --exec /usr/sbin/watchdog --pidfile /var/run/watchdog.pid \ + -- ${WATCHDOG_OPTS} + eend $? +} + +stop() { + ebegin "Stopping watchdog" + start-stop-daemon --stop \ + --exec /usr/sbin/watchdog --pidfile /var/run/watchdog.pid \ + --retry $(get_delay) + eend $? +} |