mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-20 00:33:55 +03:00
Make init.d scripts working with Debian
This commit is contained in:
parent
5e841fb9c8
commit
8bffbe91fa
@ -8,70 +8,46 @@
|
||||
# Default-Stop: 0 1 6
|
||||
### END INIT INFO
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Based on: <Pyro4 NameServer Script>
|
||||
# Copyright (C) <2011> <Pierre PACORY> - ppacory-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
|
||||
# Modified by James Muscat
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
NAME=eddn-gateway
|
||||
DESC="eddn-gateway"
|
||||
PIDFILE="/var/run/${NAME}.pid"
|
||||
LOGFILE="/var/log/eddn/${NAME}.log"
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
DAEMON="/usr/local/bin/${NAME}"
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# -------------------------------------------------------------------------
|
||||
EXEC_AS_USER="root"
|
||||
|
||||
START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid ${EXEC_AS_USER} --exec ${DAEMON}"
|
||||
STOP_OPTS="--stop --pidfile ${PIDFILE}"
|
||||
|
||||
MESSAGEDIR=/var/log/eddn
|
||||
MESSAGELOG=/var/log/eddn/gateway.log
|
||||
PID=/var/run/eddn-gateway.pid
|
||||
EXECUTABLE=/usr/local/bin/eddn-gateway
|
||||
CMDLINE=""
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
|
||||
# Check the script is being run by root user
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo 1>&2 "ERROR: The $0 script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the PID File
|
||||
touch $PID
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# create the log directory if not exist
|
||||
[ ! -d "$MESSAGEDIR" ] && mkdir -p "$MESSAGEDIR"
|
||||
|
||||
echo "Starting $EXECUTABLE"
|
||||
# test if not already running
|
||||
if [ ! -f "/proc/$(cat $PID)/exe" ]; then
|
||||
$EXECUTABLE "$CMDLINE" > "$MESSAGELOG" 2>&1 &
|
||||
echo $!>"$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already running"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping $EXECUTABLE"
|
||||
# test if running
|
||||
if [ -f "/proc/$(cat $PID)/exe" ]; then
|
||||
kill -9 "$(cat $PID)"
|
||||
rm -rf "$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already stopped"
|
||||
fi
|
||||
start)
|
||||
echo -n "Starting ${DESC}: "
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
echo "$NAME."
|
||||
rm -f $PIDFILE
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
sleep 1
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
exit 0
|
||||
|
||||
exit 0
|
@ -8,70 +8,46 @@
|
||||
# Default-Stop: 0 1 6
|
||||
### END INIT INFO
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Based on: <Pyro4 NameServer Script>
|
||||
# Copyright (C) <2011> <Pierre PACORY> - ppacory-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
|
||||
# Modified by James Muscat
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
NAME=eddn-monitor
|
||||
DESC="eddn-monitor"
|
||||
PIDFILE="/var/run/${NAME}.pid"
|
||||
LOGFILE="/var/log/eddn/${NAME}.log"
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
DAEMON="/usr/local/bin/${NAME}"
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# -------------------------------------------------------------------------
|
||||
EXEC_AS_USER="root"
|
||||
|
||||
START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid ${EXEC_AS_USER} --exec ${DAEMON}"
|
||||
STOP_OPTS="--stop --pidfile ${PIDFILE}"
|
||||
|
||||
MESSAGEDIR=/var/log/eddn
|
||||
MESSAGELOG=/var/log/eddn/monitor.log
|
||||
PID=/var/run/eddn-monitor.pid
|
||||
EXECUTABLE=/usr/local/bin/eddn-monitor
|
||||
CMDLINE=""
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
|
||||
# Check the script is being run by root user
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo 1>&2 "ERROR: The $0 script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the PID File
|
||||
touch $PID
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# create the log directory if not exist
|
||||
[ ! -d "$MESSAGEDIR" ] && mkdir -p "$MESSAGEDIR"
|
||||
|
||||
echo "Starting $EXECUTABLE"
|
||||
# test if not already running
|
||||
if [ ! -f "/proc/$(cat $PID)/exe" ]; then
|
||||
$EXECUTABLE "$CMDLINE" > "$MESSAGELOG" 2>&1 &
|
||||
echo $!>"$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already running"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping $EXECUTABLE"
|
||||
# test if running
|
||||
if [ -f "/proc/$(cat $PID)/exe" ]; then
|
||||
kill -9 "$(cat $PID)"
|
||||
rm -rf "$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already stopped"
|
||||
fi
|
||||
start)
|
||||
echo -n "Starting ${DESC}: "
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
echo "$NAME."
|
||||
rm -f $PIDFILE
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
sleep 1
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
exit 0
|
||||
|
||||
exit 0
|
@ -8,70 +8,46 @@
|
||||
# Default-Stop: 0 1 6
|
||||
### END INIT INFO
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Based on: <Pyro4 NameServer Script>
|
||||
# Copyright (C) <2011> <Pierre PACORY> - ppacory-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
|
||||
# Modified by James Muscat
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
NAME=eddn-relay
|
||||
DESC="eddn-relay"
|
||||
PIDFILE="/var/run/${NAME}.pid"
|
||||
LOGFILE="/var/log/eddn/${NAME}.log"
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
DAEMON="/usr/local/bin/${NAME}"
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# -------------------------------------------------------------------------
|
||||
EXEC_AS_USER="root"
|
||||
|
||||
START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid ${EXEC_AS_USER} --exec ${DAEMON}"
|
||||
STOP_OPTS="--stop --pidfile ${PIDFILE}"
|
||||
|
||||
MESSAGEDIR=/var/log/eddn
|
||||
MESSAGELOG=/var/log/eddn/relay.log
|
||||
PID=/var/run/eddn-relay.pid
|
||||
EXECUTABLE=/usr/local/bin/eddn-relay
|
||||
CMDLINE=""
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
|
||||
# Check the script is being run by root user
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo 1>&2 "ERROR: The $0 script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the PID File
|
||||
touch $PID
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# create the log directory if not exist
|
||||
[ ! -d "$MESSAGEDIR" ] && mkdir -p "$MESSAGEDIR"
|
||||
|
||||
echo "Starting $EXECUTABLE"
|
||||
# test if not already running
|
||||
if [ ! -f "/proc/$(cat $PID)/exe" ]; then
|
||||
$EXECUTABLE "$CMDLINE" > "$MESSAGELOG" 2>&1 &
|
||||
echo $!>"$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already running"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping $EXECUTABLE"
|
||||
# test if running
|
||||
if [ -f "/proc/$(cat $PID)/exe" ]; then
|
||||
kill -9 "$(cat $PID)"
|
||||
rm -rf "$PID"
|
||||
else
|
||||
echo "$EXECUTABLE already stopped"
|
||||
fi
|
||||
start)
|
||||
echo -n "Starting ${DESC}: "
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
echo "$NAME."
|
||||
rm -f $PIDFILE
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon $STOP_OPTS
|
||||
sleep 1
|
||||
start-stop-daemon $START_OPTS >> $LOGFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
exit 0
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user