Guest Posted January 30, 2006 Share Posted January 30, 2006 (edited) I made a start/stop/restart script for mta server for linux only! You will need package screen for this script!! apt-get install screen mta_sa #!/bin/sh # MTA San Andreas Script by Raging_Bull-NL # 27/01/2006 pwnt PATH=/bin:/usr/bin:/sbin:/usr/sbin # Edit if you like DESC="MTA San Andreas Dedicated Server" # Description DIR="/home/cstrike/mta_sa/" # Install directory of mta_sa. NAME="mtasa" # name used for screen running the server PARAMS="" # parameters (maybe usefull for future DAEMON="$DIR/startserver" # Daemon # Stop editing right now! case "$1" in start) echo "Starting $DESC: $NAME" if [ -e $DIR ]; then cd $DIR screen -d -m -S $NAME $DAEMON $PARAMS else echo "No such directory: $DIR!" fi ;; stop) if [[ `screen -ls |grep $NAME` ]] then echo -n "Stopping $DESC: $NAME" kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'` echo " ... done." else echo "Coulnd't find a running $DESC" fi ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac exit You may need to change DAEMON="$DIR/startserver" # Daemon because on some servers you don´t need the startserver script. startserver #!/bin/bash export LD_LIBRARY_PATH=/usr/local/lib ./mta_server Well here is the fun part! You don´t need anymore to switch to another console by ctrl-alt-F1/4. Just do screen -x mtasa in you console and the server screen will popup. Ohw yea, you can start your server by doing /etc/init.d/mta_sa start Ohw, and don´t forget to edit the paramters in the script! Edited February 1, 2006 by Guest Link to comment
Si|ent Posted January 30, 2006 Share Posted January 30, 2006 Nice one, someone should sticky this or put it somewhere prominent (providing it works of course) Link to comment
Guest Posted January 30, 2006 Share Posted January 30, 2006 Nice one, someone should sticky this or put it somewhere prominent (providing it works of course) Yea, sticky would be nice.. and it works offcourse! I use it myself! Link to comment
Jani Posted January 30, 2006 Share Posted January 30, 2006 DIR="/home/cstrike/mta_sa/" # Install directory of srcds. You ripped it from the srcds startscript didn't you? I did the same for mine, except I also have a script which checks every 10 seconds if the server is running, and if not, it starts it up again Link to comment
Guest Posted February 1, 2006 Share Posted February 1, 2006 DIR="/home/cstrike/mta_sa/" # Install directory of srcds. You ripped it from the srcds startscript didn't you? I did the same for mine, except I also have a script which checks every 10 seconds if the server is running, and if not, it starts it up again Yea, i did... But so what? It is working! Link to comment
Guest Posted February 5, 2006 Share Posted February 5, 2006 Startup: screen./mta_server ctrl-a, d Reattaching: screen -raAd Shutting down: screen -raAdctrl-c Why do you need a script to do that? Link to comment
Guest Posted February 5, 2006 Share Posted February 5, 2006 Startup: screen./mta_server ctrl-a, d Reattaching: screen -raAd Shutting down: screen -raAdctrl-c Why do you need a script to do that? Link to comment
Guest Posted April 14, 2006 Share Posted April 14, 2006 Just do screen -x mtasa in you console and the server screen will popup. Awesome! now, how do I get out of it, without closing down the server? Anyways,wouldn't it be easier if they just added a -d switch for deamon mode?? Link to comment
Jani Posted April 14, 2006 Share Posted April 14, 2006 CTRL + A and then CTRL +D should detatch from it without killing it. Link to comment
Recommended Posts