🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.privacy.anon-server
3 messages
3 total messages Started by Anonymous Remailer (austria) Sun, 10 Jul 2016 19:04
init.d script
#283371
Author: Anonymous Remailer (austria)
Date: Sun, 10 Jul 2016 19:04
126 lines
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
Re: init.d script
#283372
Author: Zax
Date: Sun, 10 Jul 2016 19:52
50 lines
2503 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Sun, 10 Jul 2016 21:04:14 +0200 (CEST), Anonymous Remailer (austria) wrote in
Message-Id: <84772863bb0ffc44ab0129fa435952b3@remailer.privacy.at>:

>
>   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"
BASEDIR="/home/$USER/Mix"
One less thing to configure!  :)

Nothing obviously wrong with your script.  Suggest you try manually
starting/stopping.  What's the worse that could happen?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXgqdpAAoJEC3jHKG+PvqnVKkP/2RZTaDxW7sruvQEHjYw3cno
F7o2IMH9aY9/8smufsyPz2flVzy5uPTGPqz3ESwxWN1hcTLBF71gDWeM2nztGR0K
yk4DeiO0bmTpwABdEDhNRdp1KJE5vsZXCQzgdoff7IH9kf5EF7jm2v81qXbCfQjI
ibjHqMOKt9EEN2BoUeW1oxp1rucO2PPsz9g9jqz8ir9cdsWV21Z8Sco/8v2HUUAw
JKDNeOYyLVW9adfd9+FJKlT8QUW4CiCVD/X3TGEHvpfKrcD2ndjc5nC/IPS0y/lK
+p1AuOAXG+rikmmsBQ8GvfjRxE/GaCtAIcLsE96eA7HHIorYWIbeJW3mS4T46ToX
V22d4mO4aqSzed6dAn0IfF0dYILtlhdQ3Y3wH9As8xSNLbkh/YVcYHoMerNGQ2UF
pX8Zn8kH8SuDJKGy5doU7xA18YCqtalnu2mSU+t3SB1Mf6j0YAfKR45U1QpWrKe0
DP6ExKcxXOsLlgfYtc16quzSmTFwoROUrcNHY5unEd9YPqeYGFxt0wEbG7xxgi2q
ctb7q7sfDTPuq+WTslCCb8JYJp4GqUl/5ooZtOo4Zc8jZYZI3Wvfsjsm4G0YyZBm
xsf22qpod+eCt8lKS+jskM1+Naor58loSI3smRWtoWFYZHUIqoSwBV5IjhQay+hQ
v7Sc1oIQpXAtD5cqYsyi
=le/M
-----END PGP SIGNATURE-----

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook <steve@mixmin.net>
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
sub  4096R/BE3EFAA7  created: 2014-11-14  expires: 2016-11-13  usage: S
Re: init.d script
#283384
Author: Anonymous Remailer (austria)
Date: Sun, 10 Jul 2016 22:31
8 lines
1057 bytes
> 
> Nothing obviously wrong with your script.  Suggest you try manually
> starting/stopping.

>  What's the worse that could happen?

  No more remailer.  No more Linux.  No more server.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads