aboutsummaryrefslogtreecommitdiff
path: root/_sys/etc/init.d/rescached.run
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-04-20 11:41:11 +0700
committerShulhan <ms@kilabit.info>2022-04-20 11:41:11 +0700
commitd99356259a60ac0e2c345e60b3a6c92c3fb9d764 (patch)
tree916ccaf7c1a640340d0b8b0d03fd03d616d5e502 /_sys/etc/init.d/rescached.run
parent46f8ba922984a655c34954895aaf0234bf30e822 (diff)
downloadrescached-d99356259a60ac0e2c345e60b3a6c92c3fb9d764.tar.xz
all: move all installation files into directory _sys
Previously, all files required for installing rescached scattered in different directories. This changes move all files into single directory _sys with the directory structure matched with target system.
Diffstat (limited to '_sys/etc/init.d/rescached.run')
-rwxr-xr-x_sys/etc/init.d/rescached.run84
1 files changed, 84 insertions, 0 deletions
diff --git a/_sys/etc/init.d/rescached.run b/_sys/etc/init.d/rescached.run
new file mode 100755
index 0000000..e9a602f
--- /dev/null
+++ b/_sys/etc/init.d/rescached.run
@@ -0,0 +1,84 @@
+#!/bin/sh
+## SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
+## SPDX-License-Identifier: GPL-3.0-or-later
+
+### BEGIN INIT INFO
+# Provides: rescached
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: resolver cache daemon.
+# Description: resolver cache daemon.
+### END INIT INFO
+
+RESCACHED_BIN=/usr/bin/rescached
+RESCACHED_CFG=/etc/rescached/rescached.cfg
+
+#
+# check if program exist.
+#
+test -x ${RESCACHED_BIN} || {
+ echo "Program '${RESCACHED_BIN}' not installed";
+ if [ "$1" = "stop" ]; then
+ exit 0;
+ else
+ exit 5;
+ fi;
+}
+
+#
+# check if configuration file exist.
+#
+test -r ${RESCACHED_CFG} || {
+ echo "File '${RESCACHED_CFG}' not existing";
+ if [ "$1" = "stop" ]; then
+ exit 0;
+ else
+ exit 6;
+ fi;
+}
+
+case "$1" in
+start)
+ echo -n "Starting rescached "
+ ${RESCACHED_BIN} ${RESCACHED_CFG} &
+ if test $? = 0; then
+ echo "[OK]";
+ else
+ echo "[FAIL]";
+ fi;
+ ;;
+
+stop)
+ echo -n "Shutting down rescached "
+
+ killall ${RESCACHED_PID};
+
+ if test $? = 0; then
+ echo "[OK]";
+ else
+ echo "[not running]";
+ fi;
+ ;;
+
+restart)
+ $0 stop
+ $0 start
+ ;;
+
+status)
+ echo -n "Checking for service rescached "
+ RESCACHED_PS=`ps -ef | grep "rescached -config"`
+ if [[ "${RESCACHED_PS}" -ne "" ]]; then
+ echo "[running]";
+ else
+ echo "[not running]";
+ fi;
+ ;;
+
+*)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac