very-small version for our rl-testserver
1. Install your samp-Server
2. edit the script-variables for SAMP_USER with your username, give it a “NAME”, add the “DIR” to your server-directory and add any “DESC”
3. make sure “screen is installed”
which screen
should show a path to screen, if it does, everyting is well!
4. copy init-script to /etc/init.d/samp and chmod 700 /etc/init.d/samp
5. update.rc /etc/init.d/samp
6. start with /etc/init.d/samp start
#! /bin/bash # Copyright by Dennis Diel (C) 2009 # SAMP_USER=gtasa NAME=TESTSERVER PATH=/bin:/usr/bin:/sbin:/usr/sbin DIR=/home/gtasa/testRL2009 DAEMON=samptestsrv PARAMS="" DESC="TESTSERVER" case "$1" in start) if [[ `sudo -u $SAMP_USER screen -ls | grep $NAME` ]] then echo "TESTSERVER is UP & RUNNING!" echo "You can do: $0 status" echo "You can do: $0 stop" echo "You can do: $0 restart" else echo "Starting $DESC: $NAME" cd $DIR sudo -u $SAMP_USER screen -m -d -S $NAME ./$DAEMON $PARAMS fi ;; stop) if [[ `sudo -u $SAMP_USER screen -ls | grep $NAME` ]] then echo -n "Stopping $DESC: $NAME" kill `ps aux | grep -v grep | grep -i $SAMP_USER | grep -i screen | grep -i $NAME | awk '{print $2}'` echo " ... done." else echo "$DESC $NAME is OFFLINE" fi ;; restart) if [[ `sudo -u $SAMP_USER screen -ls |grep $NAME` ]] then echo -n "Stopping $DESC: $NAME" kill `ps aux | grep -v grep | grep -i $SAMP_USER | grep -i screen | grep -i $NAME | awk '{print $2}'` echo " ... done." else echo "$DESC $NAME is OFFLINE" fi echo -n "Starting $DESC: $NAME" cd $DIR sudo -u $SAMP_USER screen -m -d -S $NAME ./$DAEMON $PARAMS echo " ... done." ;; status) ps aux | grep -v grep | grep $NAME > /dev/null CHECK=$? [ $CHECK -eq 0 ] && echo "$NAME is UP & RUNNING!" && echo "You can do: $0 stop" && echo "You can do: $0 restart" || echo "$NAME is DOWN" ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 ;; esac exit 0