Script startet nicht beim starten (TS2)

08/10/2008 - 16:07 von Stefan Becker | Report spam
Hallo,

ich habe folgendes Script, welches sich in der /etc/init.d/ befindet.
Ist mit chmod 755 ausführbar. Das Script startet nicht und nach einem
Reboot erkennt das Script nicht, dass der Server nicht mehr làuft

# ! /bin/bash
#
# Modified TeamSpeak 2 server startscript
# Original script written by: pwk.linuxfan 2004
#
# . /etc/rc.d/init.d/functions
#
### BEGIN INIT INFO
# Provides: teamspeak2
# Short-Description: TeamSpeak 2 server
# Description: Start and stop your TeamSpeak 2 server...
### END INIT INFO

# CONFIG SECTION
USER=tss
DIR=/home/tss
# END OF CONFIG SECTION

case "$1" in
start)
if [ -e $DIR/tss2.pid ]; then
echo "tss2.pid already
exists...";
echo "Is your TeamSpeak 2
server already running?"
exit 1
else
if [ "$UID" = "0" ]; then
for c in $(seq
1 10); do

echo -n "!"

sleep 1
done
echo !
fi
echo "Starting the Teamspeak 2
Server..."
if [ -e $DIR/server_linux ];
then
if [ ! -x
$DIR/server_linux ]; then

echo "server_linux is not executable..."

echo "Trying to set it."

chmod u+x $DIR/server_linux
fi
if [ -x
$DIR/server_linux ]; then

WD=`pwd`

cd $DIR

sudo -u $USER $DIR/server_linux -PID=$DIR/tss2.pid

cd $WD
else

echo "server_linux is not executable..."

exit 4
fi
else
echo "Could not
find server_linux..."
exit 5
fi
fi
;;
stop)
if [ -e $DIR/tss2.pid ]; then
echo -n "Stopping the TeamSpeak
2 server..."
if ( kill -TERM `cat
$DIR/tss2.pid` ); then
for c in $(seq
1 300); do

if [ -e $DIR/tss2.pid ]; then

echo -n "."

sleep 1

fi
done
fi
if [ -e $DIR/tss2.pid ]; then
echo "server
does not shutdown cleanly..."
kill -KILL `cat
$DIR/tss2.pid`
rm
$DIR/tss2.pid
sleep 5
else
echo "done"
fi
else
echo "tss2.pid does not
exist...";
echo "Is your TeamSpeak 2
server already stopped?"
#exit 7
fi
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
if [ -e $DIR/tss2.pid ]; then
echo "The TeamSpeak 2 server is
running."
exit 0
else
echo "The TeamSpeak 2 server is
stopped."
exit 3
fi
;;
passwords)
if [ -e $DIR/server.log ]; then
date=$(cat $DIR/server.log |
grep "admin account info: username: admin" | tail -n 1 | sed
"s/^\([0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+\).*$/\1/")
spass=$(cat $DIR/server.log |
grep "superadmin account info: username: superadmin" | tail -n 1 | sed
"s/^.*username: superadmin password: \([a-z0-9]\+\).*$/\1/")
pass=$(cat $DIR/server.log |
grep "admin account info: username: admin" | tail -n 1 | sed
"s/^.*username: admin password: \([a-z0-9]\+\).*$/\1/")
echo "Following passwords were
generated on $date"
echo "superadmin = \"$spass\""
echo "admin = \"$pass\""
else
echo "server.log not found..."
exit 1
fi
;;
*)
echo "Usage: $0
{start|stop|restart|status|passwords}"
exit 2
esac
exit 0

Was kann da das Problem sein?

MfG

Stefan Becker
 

Lesen sie die antworten

#1 helmut
08/10/2008 - 16:19 | Warnen spam
Hallo, Stefan,

Du meintest am 08.10.08:

Hallo,

ich habe folgendes Script, welches sich in der /etc/init.d/ befindet.
Ist mit chmod 755 ausführbar. Das Script startet nicht und nach einem
Reboot erkennt das Script nicht, dass der Server nicht mehr làuft

# ! /bin/bash


^da ist der Fehler.

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

Ähnliche fragen