Article View: alt.privacy.anon-server
Article #283371init.d script
From: Anonymous Remailer (austria)
Date: Sun, 10 Jul 2016 19:04
Date: Sun, 10 Jul 2016 19:04
126 lines
3931 bytes
3931 bytes
Will someone review this script to see if it looks good for auto starting mixmaster at boot, as well as manual start, stop, and restart?
#!/bin/sh
#
#
# This file auto starts a mixmaster remailers.
#
set -e
# You may need to change these items
USER=mix
VERBOSE=0
BASEDIR="/home/mix/Mix"
MIXEXE="$BASEDIR/mixmaster"
PIDFILE="$BASEDIR/mixmaster.pid"
# There be dragons below this line
CHECKUID=1
wait_for_deaddaemon () {
PID=$1
sleep 3
if test -n "$PID"
then
if kill -0 $PID 2>/dev/null
then
echo -n "Waiting for pid $PID to end."
cnt=0
while kill -0 $PID 2>/dev/null
do
cnt=`expr $cnt + 1`
if [ $cnt -gt 30 ]
then
echo " Restart Failed! - Manually check if mixmaster still running."
exit 1;
fi
sleep 2
echo -n "."
done
rm -f $PIDFILE
else
rm -f $PIDFILE
fi
fi
}
# Check if root or valid user
SU=""
if [ "$CHECKUID" -gt "0" ]; then
CUID=`id -u`
CUIDNAME=`id -nu`
if [ "$CUIDNAME" = "$USER" ]; then
SU=""
elif [ "$CUID" = "0" ]; then
SU="su $USER -c"
else
echo "You must be $USER or root. Aborting." >&2
exit 1;
fi
fi
# set VERBOSE
if [ $VERBOSE -gt 0 ]; then
VERBOSE="--verbose"
else
VERBOSE=""
fi
case $1 in
start)
if [ -f $PIDFILE ] ; then
PID=`cat $PIDFILE 2>/dev/null` || true
if kill -0 $PID 2>/dev/null
then
echo "Mixmaster is already running - start aborted!"
exit 0
else
echo -n "Removing stale mixmaster.pid file: "
rm -f $PIDFILE
echo "$PIDFILE."
fi
fi
echo -n "Starting $BASEDIR: mixmaster"
if [ ! -z "$SU" ]; then
$SU "$MIXEXE -D"
else
$MIXEXE -D
fi
echo "."
;;
stop)
echo -n "Stopping $BASEDIR: mixmaster"
if [ ! -z "$SU" ]; then
$SU "kill $PIDFILE"
else
kill $PIDFILE
fi
echo "."
;;
restart)
PID=`cat $PIDFILE 2>/dev/null` || true
kill $PIDFILE
wait_for_deaddaemon $PID
if [ ! -z "$SU" ]; then
$SU "$MIXEXE -D"
else
$MIXEXE -D
fi
;;
*)
echo "Usage: $0 (start|stop|restart)" >&2
exit 1
;;
esac
exit 0
Technical Details
Message-ID:
<84772863bb0ffc44ab0129fa435952b3@remailer.privacy.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <84772863bb0ffc44ab0129fa435952b3@remailer.privacy.at> Subject: init.d script Date: Sun, 10 Jul 2016 19:04:14 +0000 From: "Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mail Comments: This message did not originate from the Sender address above. It was remailed automatically by anonymizing remailer software. Please report problems or inappropriate use to the remailer administrator at <abuse@remailer.privacy.at>. Newsgroups: alt.privacy.anon-server Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net Lines: 126