/etc/init.d/pyro4-nsd is in pyro4 4.23-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/bin/sh
### BEGIN INIT INFO
# Provides: pyro4-nsd
# Required-Start: $time $local_fs $remote_fs $network
# Required-Stop: $time $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Pyro4 name server daemon
# Description: Debian init script for pyro4-nsd (Pyro4 name server daemon)
### END INIT INFO
# -------------------------------------------------------------------------
# <Pyro4 NameServer Daemon Script>
# Copyright (C) <2011> <Pierre PACORY> - ppacory@gmail.com
# Licensed under the "MIT Software License" for inclusion in Pyro4.
# -------------------------------------------------------------------------
LISTEN_ADDRESS=0.0.0.0
LISTEN_PORT=9999
MESSAGEDIR=/var/log/Pyro4
MESSAGELOG=/var/log/Pyro4/NameServer.log
PID=/var/run/Pyro4-NameServer.pid
# Defaults - don't touch, edit /etc/default/pyro-nsd
ENABLED=0
if [ -f /etc/default/pyro4-nsd ] ; then
. /etc/default/pyro4-nsd
fi
if [ "$ENABLED" = "0" ]; then
echo "pyro4-nsd: disabled, see /etc/default/pyro4-nsd"
exit 0
fi
# Add Pyro Config
# here you can add others ...
export PYRO_HMAC_KEY=12345
export PYRO_LOGFILE="$MESSAGELOG"
export PYRO_LOGLEVEL=DEBUG
. /lib/lsb/init-functions
# 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
# Detect if Python 2.x or Python 3.y is installed
PYTHON=python3
[ -x /usr/bin/$PYTHON ] || PYTHON=python
case "$1" in
start)
# create the log directory if not exist
[ ! -d "$MESSAGEDIR" ] && mkdir -p "$MESSAGEDIR"
echo "Starting Pyro4 Name Server"
# test if not already running
if [ ! -f "/proc/$(cat $PID)/exe" ]; then
$PYTHON -m Pyro4.naming -n "$LISTEN_ADDRESS" -p "$LISTEN_PORT" >/dev/null 2>&1 &
echo $!>"$PID"
else
echo "Pyro4 Name Server already running"
fi
;;
stop)
echo "Stopping Pyro4 Name Server"
# test if running
if [ -f "/proc/$(cat $PID)/exe" ]; then
kill -9 "$(cat $PID)"
rm -rf "$PID"
else
echo "Pyro4 Name Server already stopped"
fi
;;
restart)
$0 start
$0 stop
;;
force-reload)
$0 start
$0 stop
;;
*)
echo "usage: $0 {start|stop|restart|force-reload}"
esac
exit 0
|