Probleme rc.local debian
fonfonse
Messages postés
19
Statut
Membre
-
fonfonse Messages postés 19 Statut Membre -
fonfonse Messages postés 19 Statut Membre -
Hello
donc jetait il y a encore quelque semaine sous Ubuntu Server mais j'en ai eu marre jy arrivais pas donc je me suis dit je vais tenter ma chance avec debien et la chance a tourner donc pas trop de problème
j'ai bien installer le ssh pour utiliser putty , le ftp qui tourne a merveille avec les screen (pour faire des screen ) car j'utilise debian en console (je n'ai pas installer le système graphique)
donc j'ai pu aussi mettre kernel a 1000 HZ
maintenant j'ai juste un petit soucis avec le rc.local donc je souhaite lancer un script au démarrage qui ressemble a sa:
#!/bin/sh
echo "Starting Cs:Source Server"
sleep 1
screen -A -m -d -S css ./srv/srcds/css/srcds_run -console -game cstrike +ip 192.168.0.1 +maxplayers 6 +map de_dust2 -tickrate 100 -port 27015 -pingboost 2
il ce trouve dans:
/srv/srcds/server.sh
le fichier rc.local ressemble a sa:
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
/srv/srcds/server.sh
et le problème au démarrage de debian il me lance le script (server.sh) deux fois sa l'indique comme sa:
starting Cs:Source Server
starting Cs:Source Server
donc ce qui fait que le script lance mal ce qu'il dois lancer et sa fait confisions
qu'elle est la source du problème svp?
Merci
donc jetait il y a encore quelque semaine sous Ubuntu Server mais j'en ai eu marre jy arrivais pas donc je me suis dit je vais tenter ma chance avec debien et la chance a tourner donc pas trop de problème
j'ai bien installer le ssh pour utiliser putty , le ftp qui tourne a merveille avec les screen (pour faire des screen ) car j'utilise debian en console (je n'ai pas installer le système graphique)
donc j'ai pu aussi mettre kernel a 1000 HZ
maintenant j'ai juste un petit soucis avec le rc.local donc je souhaite lancer un script au démarrage qui ressemble a sa:
#!/bin/sh
echo "Starting Cs:Source Server"
sleep 1
screen -A -m -d -S css ./srv/srcds/css/srcds_run -console -game cstrike +ip 192.168.0.1 +maxplayers 6 +map de_dust2 -tickrate 100 -port 27015 -pingboost 2
il ce trouve dans:
/srv/srcds/server.sh
le fichier rc.local ressemble a sa:
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
/srv/srcds/server.sh
et le problème au démarrage de debian il me lance le script (server.sh) deux fois sa l'indique comme sa:
starting Cs:Source Server
starting Cs:Source Server
donc ce qui fait que le script lance mal ce qu'il dois lancer et sa fait confisions
qu'elle est la source du problème svp?
Merci
Configuration: Windows XP Firefox 2.0.0.20
6 réponses
-
Salut,
Si tu lis la fonction do_start tu vois qu'en fait le script de démarrage /etc/init.d/rc.local lance le script /etc/rc.local
Je pense que tu dois mettre la ligne /srv/srcds/server.sh dans /etc/rc.local avant exit 0
Pour faire ça soit tu utilises un éditeur de texte en root soit tu tapes en root la commandesed -i.orig 's+exit 0+/srv/srcds/server.sh\nexit 0+' rc.local /etc/rc.local
Et n'oublie pas de supprimer la ligne de lancement de ton script dans /etc/init.d/rc.local -
Hello
Merci j'essaye sa de suite
je me connect par el ftp en root et je recupere et modifie les fichier directement sur mon PC sous windows
Merci
edit:
il me marque deux fois:
usage: /etc/rc.local start|stop
Merci
edit2:
donc dans le fichier /etc/rc.local j'ai mis start a la fin le script ce lance bien mais sa ce lance toujours 2 Fois
Merci -
-
Salut,
je me connect par el ftp en root et je recupere et modifie les fichier directement sur mon PC sous windows
Surtout pas.
En faisant ça tu as ajouter le caractère CR à la fin de chaque ligne et ça ne marche pas sous Linux.
donc dans le fichier /etc/rc.local j'ai mis start
Je n'ai pas dit de faire ça.
Il a deux fichiers rc.local
- un dans /etc
- un dans /etc/init.d/
Il ne faut pas les melanger.
Ton fichier /etc/rc.local devrait être
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /srv/srcds/server.sh exit 0
Ton fichier /etc/init.d/rc/local devrait être
#! /bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $remote_fs # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Run /etc/rc.local if it exist ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { if [ -x /etc/rc.local ]; then [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)" /etc/rc.local ES=$? [ "$VERBOSE" != no ] && log_end_msg $ES return $ES fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac -
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
Hello
donc dans le fichier /etc/init.d/rc.local j'ai:
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
dans le fichier /etc/rc.local j'ai:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/srv/srcds/server.sh
exit 0
quand je redémarre sa me marque:
usage: /etc/rc.local start|stop deux fois
Merci
edit:
donc je vien de remodifier le fichier /etc/rc.local mais cette fois si direct par la commande nano et cette fois si j'ai pas mis le start a la fin j'ai mis comme tu a dit sa ce lance bien mais toujours deux fois
Merci -