This script has 'killall screen' multiple times in it, killing every running instance of screen is not cool.
kill $(ps faux | grep "${server_start}" | grep -i screen | awk '{print $2}') 2> /dev/null
kill $(ps faux | grep inotifywait | grep $server_path | awk '{print $2}') 2> /dev/null
Instead of picking on how things are done, I should help out some. I'll fork her and see what I can come up with@ncreen_same: Good point, the server I'm running only runs FTB so that's the only thing that is ever running in screen. I'll poke through and find a way to kill only the screen that has the previous instance of FTB opened in it.
@gustav9797 : How are you downloading/running that? According to the error message, line 4 that it's erroring out on has <!DOCTYPE html> in it, which shouldn't be anywhere in the script. ;p
Are you grabbing the script with wget? You'd want to get it like so:
$ wget http://raw.github.com/Sindern/rtb/master/rtb.sh
Also, for some reason that drives me crazy, all my github downloads come out in DOS linebreak format, so you'd need to convert it to unix linebreak format. I use dos2unix for it.
-edit-
Got it where it should only kill inotifywait or screen if it's related to the FTB server in question:
Not pretty, but it seems to work so far.Code:kill $(ps faux | grep "${server_start}" | grep -i screen | awk '{print $2}') 2> /dev/null kill $(ps faux | grep inotifywait | grep $server_path | awk '{print $2}') 2> /dev/null
#! /bin/bash
#SET THE FOLLOWING VARIABLES!
SERVERDIRECTORY="/home/minecraft/ftb"
SAVETO="/home/minecraft/ftb-backups"
rdiff-backup $SERVERDIRECTORY $SAVETO
exit
while true
do
if [[ -n $(netstat -anp | grep :25565) ]]; then
echo "Up"
else
echo "Down"
for session in $(screen -ls | grep -o '[0-9]*\.Ftb-Server'); do screen -S "${session}" -X quit; done
fi
sleep 25
done