3
# pingcntl: echolot control + wrapper
4
# Written by admin@arancio.net, peter@palfrader.org
8
# Required-Start: $local_fs $remote_fs $time
9
# Required-Stop: $local_fs $remote_fs
10
# Should-Start: mail-transport-agent $syslog
11
# Should-Stop: mail-transport-agent $syslog
12
# Default-Start: 2 3 4 5
14
# Short-Description: Pinger for anonymous remailers
15
# Description: Echolot is a pinger for anonymous remailers
16
# such as Mixmaster. As the name implies it
17
# regularly sends pings to remailers to
18
# collect performance statistics on each node.
25
# You probably don't want to mess with stuff below this line
26
################################################################
28
RUNDIR=/var/run/echolot
29
PIDFILE="$RUNDIR/pingd.pid"
35
DESC="Echolot Ping Daemon"
37
test -f $DAEMON || exit 0
39
PATH=/bin:/usr/bin:/sbin:/usr/sbin
42
# Reads config file (will override defaults above)
43
[ -r /etc/default/echolot ] && . /etc/default/echolot
45
if [ ! -d ${RUNDIR} ]; then
47
chown root:"$GROUP" "$RUNDIR"
51
wait_for_deaddaemon () {
56
if kill -0 $PID 2>/dev/null
58
echo -n "Waiting for pid $PID ."
60
while kill -0 $PID 2>/dev/null
79
# Check for evil ulimits
80
if [ "$CHECKULIMIT" -gt "0" ]; then
83
if [ "$FDs" -lt "512" ]; then
84
if [ "$HFDs" -lt "512" ]; then
85
echo "Hardlimit for open File Descriptors is less than 512." >&2
86
echo "Please consider raising it." >&2
87
if [ "$FDs" -lt "$HFDs" ]; then
88
echo "Raising it to $HFDs" >&2
92
if [ "$HFDs" -lt "1024" ]; then
97
echo "Softlimit for open File Descriptors is less than 512." >&2
98
echo "Raising it to $FDs" >&2
106
if [ $VERBOSE -gt 0 ]; then
116
if [ -f $PIDFILE ] ; then
117
PID=`cat $PIDFILE 2>/dev/null` || true
118
if kill -0 $PID 2>/dev/null
120
echo "$DESC already running."
123
echo -n "Removing stale pid file: "
128
if [ $RUN_ECHOLOT -gt 0 ]; then
129
echo -n "Starting $DESC: "
134
--chuid $USER:$GROUP \
135
--exec $DAEMON -- --detach $VERBOSE --process --quiet start
138
echo "Not starting $DESC: disabled in configuration"
143
echo -n "Stopping $DESC: "
144
PID=`cat $PIDFILE 2>/dev/null` || true
151
wait_for_deaddaemon $PID
155
reload|force-reload|restart)
156
PID=`cat $PIDFILE 2>/dev/null` || true
158
wait_for_deaddaemon $PID
161
process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|sendchainpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary|enable|disable)
162
# Check for right User
163
if [ "$CHECKUID" -gt "0" ]; then
166
if [ "$CUIDNAME" = "$USER" ]; then
168
elif [ "$CUID" = "0" ]; then
170
while [ "$#" -gt 0 ]; do
171
command="$command \"$1\""
174
su "$USER" -c "$command"
176
echo "You are neither $USER nor root. Aborting." >&2
181
echo "Running $DESC: $NAME $1..."
185
echo "Usage: $0 (start|stop|reload|force-reload|restart)" >&2
186
echo " $0 <COMMAND> [parameters]" >&2
187
echo "See the pingd(1) manual page for valid commands" >&2
195
# vim:set shiftwidth=2: