https://www.17buddies.rocks/index.html

17's Buddies Maps HL1 Maps HL2 Wads Plan des Maps
17 Buddies
Only for stats

Welcome Guest ( Log In | Register )

Script Pour Démarrage Serveur Dédié Linux, Correction du script de démarrage CS
godzilla
post 02/06/2005 - 19:57:54 |   Post #1
+Reply

Group: Member
Posts: 420
Joined: 28/12/2004

de 
Team:
CC+I7B_Ogames


[B]Salut a tous, j ai crée sur mon serveur root ( suse 9.0 Linux) , des serveurs jeux dédié ( CS 1.6 - Source - DOD - Rally )qui fonctionne sans problèmes et s ´actualisent automatiquement après chaque reboot et restart automatiquement en cas de crash de ceux-ci .
Mon problème est de corriger mon script de demarrage des serveurs jeux pour qu il puissent automatiquement se mettre en fonctionement après un reboot complet du serveur root .
Le script suivant fonctionne uniquement sur root ( je veus le démarrer en user pub24 uniquement )et de plus il ne fonctionne que après un démarrage manuel et non après un reboot serveur complet.
Merci d´avance pour votre aide.



voici les renseignements de mon serveur :
exemple pour un jeux CS1.6
le jeux CS est dans le répertoire suivant : /home/pub24/cs16
le user qui devrais démarrer le serveur s ´appelle : pub24
j ai mis mon script (s appelle hlds) dans le répertoire : /etc/init.d/
et mis celui-ci en execution avec : chmod 755 /etc/init.d/hlds
apres ca mis les links avec : ln -s /etc/init.d/hlds /etc/init.d/rc3.d/S90hlds
:ln -s /etc/init.d/hlds /etc/init.d/rc3.d/K30hlds

script:

#!/bin/sh
#
# Start the Counter-Strike dedicated server as non-root.
#
# A modification of the CS Server startup script, to run the server
# as a non-root user.
#
# ORIGINAL AUTHORS :
#
# Julien Escario ( pandemik@asylog.net )
# &
# Cedric Rochat ( crochat@younics.org )
#
# ===========================================
#
# What you need:
#
# Linux (IMG:http://forum.17buddies.rocks/style_emoticons/default/smile.gif)
# awk
# screen
# the hlds_l & cstrike-files OR
# a STEAM-installation
#
# YES, this script works fine with STEAM and CS 1.6
#
# How to use:
#
# Edit the DIR-var to fit your system (just contains the path to the dir that contains hlds_run)
# Edit the PARAMS-var to fit your needs
# Edit the CS_USER-var to the name of the user that will run the server
#
# How to see the server-console:
#
# Just type in: screen -r hlds (or whatever you set $NAME to)
# More info about screen can be found by typing "man screen" or using this nice link
# http://server.counter-strike.net/server.ph...wto&show=screen
#
# The easist way is to use this script simple as a start-script for your server
# If you want to use it as a script to start the server at boot-time:
#
# When this is done, copy the file to /etc/rc.d/init.d (or whereever your system stores the
# scripts for starting the services
# Now you can link the script to your runlevel-dir, here's an example for runlevel 3:
# (THIS IS FOR DEBIAN! If you use e.g. Redhat you must change these dirs!!!)
#
# ln -s /etc/init.d/hlds /etc/rc3.d/S90hlds
# ln -s /etc/init.d/hlds /etc/rc6.d/K50hlds
#
# Or use it manualy like:
# /etc/rc.d/init.d/hlds start
# /etc/rc.d/init.d/hlds stop
#
# If you don't want to start the server as root you have to change this:
# add the var CS_USER and uncomment it
# change the lines at the "start-block"
#
# You must be logged in as this user to re-attach the screen!
#
# DOC by jwm (jwm@counter-strike.de)

# The user that will run the server
CS_USER=pub24

# Leave this alone.
NAME=hlds

PATH=/bin:/usr/bin:/sbin:/usr/sbin

# DON'T FORGET TO CHANGE THE PATH TO YOUR NEEDS!
DIR=/home/pub24/cs16

# Leave this alone.
DAEMON=hlds_run

# Internet-server:
PARAMS="-game cstrike +map de_aztec +maxplayers 16"

# Leave this alone.
DESC="Counter-Strike dedicated server"

case "$1" in
start)
if [[ `su $CS_USER -c "screen -ls |grep $NAME"` ]]
then
echo "HLDS is already running!"
else
echo "Starting $DESC: $NAME"
su $CS_USER -c "cd $DIR; screen -m -d -S hlds ./$DAEMON $PARAMS"
fi
;;

stop)
if [[ `su $CS_USER -c "screen -ls |grep $NAME"` ]]
then
echo -n "Stopping $DESC: $NAME"
kill `ps aux | grep -v grep | grep -i $CS_USER | grep -i screen | grep -i $NAME | awk '{print $2}'`
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
;;

restart)
if [[ `su $CS_USER -c "screen -ls |grep $NAME"` ]]
then
echo -n "Stopping $DESC: $NAME"
kill `ps aux | grep -v grep | grep -i $CS_USER | grep -i screen | grep -i $NAME | awk '{print $2}'`
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi

echo -n "Starting $DESC: $NAME"
su $CS_USER -c "cd $DIR; screen -m -d -S hlds ./$DAEMON $PARAMS"
echo " ... done."
;;

status)
ps aux | grep -v grep | grep hlds_r > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "HLDS is UP" || echo "HLDS is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac

exit 0
Post PM
Website
Go to the top of the page
 
New
Replies
godzilla
post 05/06/2005 - 23:00:24 |   Post #2
+Reply

Group: Member
Posts: 420
Joined: 28/12/2004

de 
Team:
CC+I7B_Ogames


Voila , j ai trouvé un script qui fonctionne avec le user (pub24) et non pas sur root ( admin) et de plus il est facile a employer , la seule chose encore que j aurais besoin serait de me dire comment je dois faire pour démarrer le script automatiquement apres un reboot de la machine (materiel), le script ici est mis dans le repertoire du jeux et est demarrer par l odre ./serv_start avec la console manuellement .merci d avance

en fait il existe 2 scripts mis dans le repertoire du jeux:
le 1 donne l acces au 2
voici le 1:( s appelle serv_start)

#!/bin/sh
/home/pub24/cs16/serv_astart &


voici le 2: (s appelle serv_astart)

#!/bin/sh
dir="/home/pub24/cs16/"
MAP="de_dust"
PORT="27015"
IP="192.168.1.8"
PLAYERS="12"
logfile=$dir"/serv_astart.txt"
while : ; do
echo "Serveur lancé sans problèmes"
start=`date '+%d%H%M%S'`
echo "Serveur lancé : `date`" >> $logfile
export LD_LIBRARY_PATH=$dir:$LD_LIBRARY_PATH
cd $dir
./hlds_run -game cstrike +maxplayers $PLAYERS +map $MAP -port $PORT -ip $IP -pingboost 3

stop=`date '+%d%H%M%S'`
echo "Serveur Arreté: `date`" >> $logfile
t=`expr $stop - $start`
if test 0 -le $t -a $t -lt 5 ; then
failcount=`expr $failcount + 1`
else
failcount=0
fi
if test $failcount -gt 5 ; then
echo "Arrêt du serveurs, problème interne à HLDS,Veuillez regarder la configuration" >&2
exit 1
fi
sleep 10
done
Post PM
Website
Go to the top of the page

Posts in this topic
- godzilla   Script Pour Démarrage Serveur Dédié Linux   02/06/2005 - 19:57:54
- - Patxi   simple question de non connaisseur : t'es bien...   02/06/2005 - 21:20:17
- - godzilla   en fait le script démarre uniquement si je met la...   02/06/2005 - 23:00:16
|- - Patxi   1)QUOTE (godzilla @ 02/06/2005 à 23:00:16)qu...   03/06/2005 - 08:50:08
- - benneb   j'aurais bienn voulu te repondre, mais je trou...   03/06/2005 - 01:20:39
- - benneb   QUOTE (godzilla @ 02/06/2005 à 20:57:54)j ai...   03/06/2005 - 01:24:04
- - Klendhaar   je me permet de repondre pour lui, lol je sais ou ...   03/06/2005 - 07:16:35
- - godzilla   Merci pour les réponses , effectivement comme a d...   03/06/2005 - 14:29:05
- - benneb   QUOTE j ai mis mon script (s appelle hlds) dans le...   03/06/2005 - 15:03:36
- - godzilla   Voila , j ai trouvé un script qui fonctionne avec...   05/06/2005 - 23:00:24
- - Patxi   godzilla, ton script qui lance CS on va considére...   06/06/2005 - 08:58:25
- - benneb   apres un reboot, si ca te loggue automatiquement e...   06/06/2005 - 12:13:26
- - panda   faut que tu mettes un lien symbolique de ton scrip...   08/10/2005 - 15:26:20
- - Nosferatu   QUOTE (godzilla @ 02/06/2005 à 19:57:54)Salu...   08/10/2005 - 16:52:01
- - godzilla   Merci a vous tous , pour les réponses a mes quest...   08/10/2005 - 18:38:16
- - Acidounet   sinon perso a l epoque de clubic pour les lancer s...   08/10/2005 - 22:29:56
- - Nosferatu   monsieur l'administrateur reseau, je ne sais p...   08/10/2005 - 22:46:12
- - Patxi   QUOTE (Nosferatu @ 08/10/2005 à 22:46:12)mon...   10/10/2005 - 07:56:35

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

New
 


RSS Lo-Fi Version
 
Skin © Chapo