Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Stoppst du auch den Screen? Wenn ich das so richtig sehe fragst du den Screen ab ob der da ist oder nicht.@edit: da ich noch keinen Crash hatte bisher, tue ich den Bot stoppen um zu testen, damit per cron die watch.sh gestartet wird. Liegt eventl. da der Fehler?
#! /bin/bash
##################################################################################
# #
# Usage: ./launch.sh {start|stop|status|restart|console} #
# - start: start the bot #
# - stop: stop the bot #
# - status: display the status of the bot (down or up) #
# - restart: restart the bot #
# - console: display the bot console #
# To exit the console without stopping the server, press CTRL + A then D. #
# #
##################################################################################
SCREEN_NAME="ts3bot"
USER="xuxe"
DIR_ROOT="/opt/ts3soundboard/"
BOT_RUNCMD="./sinusbot"
# No edits necessary beyond this line
PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ ! -x `which awk` ]; then echo "ERROR: You need awk for this script (try apt-get install awk)"; exit 1; fi
if [ ! -x `which screen` ]; then echo "ERROR: You need screen for this script (try apt-get install screen)"; exit 1; fi
function start {
if [ ! -d $DIR_ROOT ]; then echo "ERROR: $DIR_ROOT is not a directory"; exit 1; fi
if status; then echo "$SCREEN_NAME is already running"; exit 1; fi
# Start bot
if [ `whoami` = root ]
then
su - $USER -c "cd $DIR_ROOT ; screen -AmdS $SCREEN_NAME $BOT_RUNCMD"
else
cd $DIR_ROOT
screen -AmdS $SCREEN_NAME $BOT_RUNCMD
fi
}
function stop {
if ! status; then echo "$SCREEN_NAME could not be found. Probably not running."; exit 1; fi
if [ `whoami` = root ]
then
su - $USER -c "killall sinusbot -u $USER"
else
killall ts3bot -u $USER
fi
}
function status {
if [ `whoami` = root ]
then
su - $USER -c "screen -ls" | grep [.]$SCREEN_NAME[[:space:]] > /dev/null
else
screen -ls | grep [.]$SCREEN_NAME[[:space:]] > /dev/null
fi
}
function console {
if ! status; then echo "$SCREEN_NAME could not be found. Probably not running."; exit 1; fi
if [ `whoami` = root ]
then
tmp=$(su - $USER -c "screen -ls" | awk -F . "/\.$SCREEN_NAME\t/ {print $1}" | awk '{print $1}')
su - $USER -c "screen -r $tmp"
else
screen -r $(screen -ls | awk -F . "/\.$SCREEN_NAME\t/ {print $1}" | awk '{print $1}')
fi
}
function usage {
echo "Usage: $0 {start|stop|status|restart|console}"
echo "On console, press CTRL+A then D to stop the screen without stopping the server."
}
case "$1" in
start)
echo "Starting $SCREEN_NAME..."
start
sleep 5
echo "$SCREEN_NAME started successfully"
;;
stop)
echo "Stopping $SCREEN_NAME..."
stop
sleep 5
echo "$SCREEN_NAME stopped successfully"
;;
restart)
echo "Restarting $SCREEN_NAME..."
status && stop
sleep 10
start
sleep 5
echo "$SCREEN_NAME restarted successfully"
;;
status)
if status
then echo "$SCREEN_NAME is UP"
else echo "$SCREEN_NAME is DOWN"
fi
;;
console)
echo "Open console on $SCREEN_NAME..."
console
;;
*)
usage
exit 1
;;
esac
exit 0
#! /bin/bash
##################################################################################
# #
# Usage: ./launch.sh {start|stop|status|restart|console} #
# - start: start the bot #
# - stop: stop the bot #
# - status: display the status of the bot (down or up) #
# - restart: restart the bot #
# - console: display the bot console #
# To exit the console without stopping the server, press CTRL + A then D. #
# #
##################################################################################
SCREEN_NAME="ts3bot"
USER="xuxe"
DIR_ROOT="/opt/ts3soundboard/"
BOT_RUNCMD="./sinusbot"
# No edits necessary beyond this line
PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ ! -x `which awk` ]; then echo "ERROR: You need awk for this script (try apt-get install awk)"; exit 1; fi
if [ ! -x `which screen` ]; then echo "ERROR: You need screen for this script (try apt-get install screen)"; exit 1; fi
function start {
if [ ! -d $DIR_ROOT ]; then echo "ERROR: $DIR_ROOT is not a directory"; exit 1; fi
if status; then echo "$SCREEN_NAME is already running"; exit 1; fi
# Start bot
if [ `whoami` = root ]
then
su - $USER -c "cd $DIR_ROOT ; screen -AmdS $SCREEN_NAME $BOT_RUNCMD"
else
cd $DIR_ROOT
screen -AmdS $SCREEN_NAME $BOT_RUNCMD
fi
}
function stop {
if ! status; then echo "$SCREEN_NAME could not be found. Probably not running."; exit 1; fi
if [ `whoami` = root ]
then
su - $USER -c "screen -S $SCREEN_NAME -X stuff '\003'"
else
screen -S $SCREEN_NAME -X stuff '\003'
fi
}
function status {
if [ `whoami` = root ]
then
su - $USER -c "screen -ls" | grep [.]$SCREEN_NAME[[:space:]] > /dev/null
else
screen -ls | grep [.]$SCREEN_NAME[[:space:]] > /dev/null
fi
}
function console {
if ! status; then echo "$SCREEN_NAME could not be found. Probably not running."; exit 1; fi
if [ `whoami` = root ]
then
tmp=$(su - $USER -c "screen -ls" | awk -F . "/\.$SCREEN_NAME\t/ {print $1}" | awk '{print $1}')
su - $USER -c "screen -r $tmp"
else
screen -r $(screen -ls | awk -F . "/\.$SCREEN_NAME\t/ {print $1}" | awk '{print $1}')
fi
}
function usage {
echo "Usage: $0 {start|stop|status|restart|console}"
echo "On console, press CTRL+A then D to stop the screen without stopping the server."
}
case "$1" in
start)
echo "Starting $SCREEN_NAME..."
start
sleep 5
echo "$SCREEN_NAME started successfully"
;;
stop)
echo "Stopping $SCREEN_NAME..."
stop
sleep 5
echo "$SCREEN_NAME stopped successfully"
;;
restart)
echo "Restarting $SCREEN_NAME..."
status && stop
sleep 10
start
sleep 5
echo "$SCREEN_NAME restarted successfully"
;;
status)
if status
then echo "$SCREEN_NAME is UP"
else echo "$SCREEN_NAME is DOWN"
fi
;;
console)
echo "Open console on $SCREEN_NAME..."
console
;;
*)
usage
exit 1
;;
esac
exit 0
Ich habe hier eine alternative, für die die den "killall" aus irgendwelchen Gründen nicht ausführen können ^^