Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

L4D2 Server Restarter


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Description

linux is the operating system of choice when using this plugin.
This plugin basically only shuts down your server after all players disconnect or every 2 hours (to keep i refreshed). It requires that you use a seperate cronjob & restart shell script to reboot the server.

Other games can use the server command "_restart" to restart their game engine but it doesn't work on L4D2, so that's why we set up the configuration in this way.


Recommended cron job & auto-restart.sh script:

Cron job:
Code:

# Automatically reboot the server if it goes down
* * * * * /path/to/auto-restart.sh

auto-restart.sh
Note:
* Assumes the name of the screen session is "left4dead2_server" and your bootup script is named "start.sh"
* Need to edit "/path/to/start.sh"
PHP Code:

#!/bin/bash
 
alive=`ps ux | grep 'left4dead2_server' | wc -l | awk '{ print $1 }'`
 
if [ 
$alive -lt 2 ]; then
        
echo "First Check: l4d2 server offline."
        
sleep 3s
       
        alive2
=`ps ux | grep 'left4dead2_server' | wc -l | awk '{ print $1 }'`
        if [ 
$alive2 -lt 2 ]; then
            
echo "Second Check: l4d2 server still offline."
            
sleep 3s
           
            alive3
=`ps ux | grep 'left4dead2_server' | wc -l | awk '{ print $1 }'`
            if [ 
$alive3 -lt 2 ]; then
                
echo "Third Check: Starting l4d2 server..."
                
sleep 2s
                
/path/to/start.sh
            
else
                echo 
"Third Check: L4D2 server already active. Terminating.."
                
sleep 3s
            fi
        
else
            echo 
"Second Check: L4D2 server already active. Terminating.."
            
sleep 3s
        fi
   
else
    echo 
"First Check: L4D2 server already active. Terminating.."
    
sleep 3s
fi 

Install

Put .smx file in addons/sourcemod/plugins

Attached Files
File Type: smx L4D2 Server Restarter.smx (5.4 KB)
File Type: sp Get Plugin or Get Source (L4D2_ServerRestarter.sp - 5.7 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...