Screen TF2 Server ausschalten

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
Swat6
Beiträge: 10
Registriert: 06.02.2013 13:29:15

Screen TF2 Server ausschalten

Beitrag von Swat6 » 07.02.2013 16:21:21

Hallo

Ich habe eben entdeckt, dass auf meinem Server 4 Screen Prozesse laufen, die alle einen TF2 Server laufen lassen. Wie kann ich diese Prozesse nun ausschalten, so dass ich nur noch einen Server am laufen habe?

Im Moment sieht es bei mir bei PuTTY so aus:



Nur weiss ich nicht genau, was ich hier eingeben muss, damit ich die Screen Prozesse ausschalten kann.

MFG

Adrian
Zuletzt geändert von Swat6 am 07.02.2013 16:49:28, insgesamt 1-mal geändert.

Cae
Beiträge: 6349
Registriert: 17.07.2011 23:36:39
Wohnort: 2130706433

Re: Screen TF2 Server ausschalten

Beitrag von Cae » 07.02.2013 16:23:53

-r {PID}.tf2, so wie's in der Liste steht. Im Uebrigen ist das Plaintext, da verlinkt man bitteschoen keinen Screenshot.

Gruss Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.

—Bruce Schneier

Swat6
Beiträge: 10
Registriert: 06.02.2013 13:29:15

Re: Screen TF2 Server ausschalten

Beitrag von Swat6 » 07.02.2013 16:54:14

Ah, danke, habe ich nicht gewusst, das man das nicht verlinkt :S Und dann kann man die Screens ja mit CTRL+D beenden wenn ich das richti sehe oder?

uname
Beiträge: 12482
Registriert: 03.06.2008 09:33:02

Re: Screen TF2 Server ausschalten

Beitrag von uname » 07.02.2013 19:00:43

Du kannst mal

Code: Alles auswählen

screen -ls
machen. Ganz vorne stehe die Prozess-ID. Einfach wegkillen und anschließend evtl. noch

Code: Alles auswählen

screen -wipe
Für die Zukunft Screen einfach immer per

Code: Alles auswählen

screen -dRR
aufrufen.

Cae
Beiträge: 6349
Registriert: 17.07.2011 23:36:39
Wohnort: 2130706433

Re: Screen TF2 Server ausschalten

Beitrag von Cae » 07.02.2013 23:42:09

Swat6 hat geschrieben:Und dann kann man die Screens ja mit CTRL+D beenden wenn ich das richti sehe oder?
Wenn du einen wieder attached hast und in der darin laufenden Shell bist, wird sie mit C-d beendet. Mit C-a C-d wuerdest du stattdessen den Screen wieder detachen.

Gruss Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.

—Bruce Schneier

H3llGhost
Beiträge: 137
Registriert: 20.09.2009 11:33:47

Re: Screen TF2 Server ausschalten

Beitrag von H3llGhost » 11.02.2013 21:10:17

Hallo,

also ich habe folgendes init-Skript in der Benutzung. Eventuell hilft es dir. :)

Code: Alles auswählen

#Source Dedicated Server Init Script

# Server options
TITLE='Team Fortress 2 Server' # Script initialization title
LONGNAME='Team Fortress 2'        # Full title of game type
NAME='tf2'                          # Server handle for the screen session
DAEMON='srcds_run'                # The server daemon
UPDATER='/home/srcds'        # The Steam updater. I recommend keeping it one directory below orangebox for tf2 servers.
STEAM='/home/srcds/orangebox'        # STEAM to Steam installation
USER='srcds'                        # User that this will be running under. Currently not functional part of this script.

# Game options
IP='...'                # IP of the server
PORT='27015'                    # Port number to
MAP='cp_well'                    # Initial map to start
GAME='tf'                        # Game type (tf|cstrike|valve|hl2mp)
SIZE='24'                        # Maximum number of players
HIGHPRIORITY=1                #Set server renice to -20 will make server take priority over all other applications on server. 1 being on and 0 being off.

# Server options string
OPTS="-game $GAME +map $MAP -debug -tickrate 100 -ip $IP -port $PORT -autoupdate +maxplayers $SIZE -pidfile $STEAM/$GAME/$NAME.pid"

# Screen command
CURRENT_USER=$(/usr/bin/whoami)
if [ "$CURRENT_USER" = "$USER" ]; then
    echo "Use current user ..."
    INTERFACE="/usr/bin/screen -A -m -d -S $NAME"
  else
    echo "Use user $USER ..."
    INTERFACE="sudo -u $USER /usr/bin/screen -A -m -d -S $NAME"
fi


service_start() {
    echo "Starting $TITLE"
    if [ -f $STEAM/$GAME/$NAME.pid ]; then
      if [ "$(ps -p 'cat $STEAM/$GAME/$NAME.pid' | wc -l)" gt -1 ]; then
        echo -e "Error: Server is already online."
      else
        if [ "$(ps -p 'cat $STEAM/$GAME/$NAME.pid' | wc -l)" -gt 1 ]; then
          for id in 'cat $STEAM/$GAME/$NAME.pid'
            do kill -9 $id
            echo "Killing process $id."
            echo "Removing screen PID file."
            rm -rf $STEAM/$GAME/$NAME-screen.pid
            break
          done
        fi
        echo "Removing server PID file."
        rm -rf $STEAM/$GAME/$NAME.pid
        screen -wipe 1> /dev/null 2> /dev/null
        service_start
      fi
    else
      if [ -x $STEAM/$DAEMON ]; then
        echo "----------------------------------------"
        echo "Name:        $TITLE"
        echo "Game:        $SRCDS"
        echo "IP:        $IP"
        echo "Port:        $PORT"
        echo "Slots:    $SLOTS players"
        echo "----------------------------------------"
        cd $STEAM
        $INTERFACE $STEAM/$DAEMON $OPTS
        sleep 1
        ps -ef | grep SCREEN | grep "$NAME" | grep -v grep | awk '{print $2}' > $STEAM/$GAME/$NAME-screen.pid
        echo "$TITLE screen process:"
        echo "  $STEAM/$GAME/$NAME-screen.pid"
        echo "$TITLE server process:"
        echo "  $STEAM/$GAME/$NAME.pid"
        chmod 666 $STEAM/$GAME/*.pid 1> /dev/null 2> /dev/null
        chown $USER $STEAM/$GAME/*.pid 1> /dev/null 2> /dev/null
        sleep 2
        if [ $HIGHPRIORITY = 1 ]; then
          renice -20 'cat $STEAM/$GAME/$NAME.pid' > /dev/null 2>&1
        fi
        echo "----------------------------------------"
        echo 'Done.'
      else
        echo 'Error: Server could not be started.'
      fi
    fi
}

service_stop() {
    if [ -f $STEAM/$GAME/$NAME.pid ] || [ -f $STEAM/$GAME/$NAME-screen.pid ]; then
        echo "Stopping $TITLE - $LONGNAME."
        # Get the process ID from the pid file we created earlier
        for id in `cat $STEAM/$GAME/$NAME-screen.pid`
            do kill -9 $id
            echo "Killing process ID $id"
            echo "Removing $TITLE screen pid file"
            rm -rf $STEAM/$GAME/$NAME-screen.pid
            break
        done
        # Remove server pid file
        echo "Removing $TITLE pid file"
        rm -rf $STEAM/$GAME/$NAME.pid
        # Wipe all old screen sessions
        screen -wipe 1> /dev/null 2> /dev/null
        echo "$TITLE stopped."
    else
        echo -e "Cannot stop $TITLE.  Server is not running."
        #exit 1
    fi    
}    
service_clear() {
    # Removing all pid files
    echo "Removing all Service pid files."
    rm -rf $STEAM/$GAME/*.pid 1> /dev/null 2> /dev/null
}

service_update() {
    echo "Stopping and Clearing all Service files."
    service_stop
    sleep 2
    service_clear
    sleep 2
    echo "Updating Steam Updater"
    cd $UPDATER
    ./steam 1> /dev/null 2> /dev/null
    echo "Updating Game Files"
    ./steam -command update -game $GAME -dir . 1> /dev/null 2> /dev/null
    sleep 2
    service_start
}


case "$1" in
    'start')
        service_start
        ;;
    'stop')
        service_stop
        ;;
    'restart')
        service_stop
        sleep 1
        service_start
        ;;
    'clear')
        service_clear
        ;;
    'update')
        service_update
        ;;
    *)
        echo "Usage $0 start|stop|restart|clear|update"
esac

Cae
Beiträge: 6349
Registriert: 17.07.2011 23:36:39
Wohnort: 2130706433

Re: Screen TF2 Server ausschalten

Beitrag von Cae » 12.02.2013 13:46:39

H3llGhost hat geschrieben:

Code: Alles auswählen

          for id in 'cat $STEAM/$GAME/$NAME.pid'
Du willst Backticks ` verwenden, besser aber die gleichbedeutende (und besser zu erkennende) Subshell $(...). Unten ist's richtig gemacht mit Backticks.

Das hat mit deinem eigentlichen Problem vermutlich nix zu tun, faellt mir aber beim Lesen auf.

Gruss Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.

—Bruce Schneier

Antworten