Skip to content

Commit

Permalink
Monitor no longer starts server if stop used
Browse files Browse the repository at this point in the history
If the administrator stops the server using the stop command the monitor
will disable itself preventing the server from starting back up on its
own
  • Loading branch information
dgibbs64 committed Jun 24, 2014
1 parent 111835a commit 6b120e2
Show file tree
Hide file tree
Showing 19 changed files with 249 additions and 47 deletions.
15 changes: 13 additions & 2 deletions CounterStrike/csserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -41,6 +41,7 @@ engine="goldsource"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/cstrike"
executabledir="${filesdir}"
Expand Down Expand Up @@ -465,6 +466,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -558,6 +565,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -617,7 +628,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
15 changes: 13 additions & 2 deletions CounterStrikeConditionZero/csczserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -41,6 +41,7 @@ engine="goldsource"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/czero"
executabledir="${filesdir}"
Expand Down Expand Up @@ -465,6 +466,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -558,6 +565,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -617,7 +628,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
15 changes: 13 additions & 2 deletions CounterStrikeGlobalOffensive/csgoserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -59,6 +59,7 @@ engine="source"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/csgo"
executabledir="${filesdir}"
Expand Down Expand Up @@ -484,6 +485,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -577,6 +584,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -603,6 +612,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -637,7 +648,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
15 changes: 13 additions & 2 deletions CounterStrikeSource/cssserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -42,6 +42,7 @@ engine="source"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/cstrike"
executabledir="${filesdir}"
Expand Down Expand Up @@ -466,6 +467,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -559,6 +566,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -618,7 +629,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
19 changes: 15 additions & 4 deletions DayOfDefeat/dodserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -41,6 +41,7 @@ engine="goldsource"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dod"
executabledir="${filesdir}"
Expand Down Expand Up @@ -253,7 +254,7 @@ else
while true; do
read -p "Do you want to start the server? [y/N]" yn
case $yn in
[Yy]* ) fn_startserver;break;;
[Yy]* ) fn_startserver; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
Expand Down Expand Up @@ -287,7 +288,7 @@ if [ ${tmuxwc} -eq 1 ]; then
while true; do
read -p "Would you like to stop ${servicename} while running the backup? [y/N]" yn
case $yn in
[Yy]* ) fn_stopserver;break;;
[Yy]* ) fn_stopserver; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
Expand Down Expand Up @@ -465,6 +466,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -558,6 +565,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -583,6 +592,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -617,7 +628,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
15 changes: 13 additions & 2 deletions DayOfDefeatSource/dodsserver
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 050214
# Version: 220614

#### Variables ####

Expand Down Expand Up @@ -42,6 +42,7 @@ engine="source"
# Directorys
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/')
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/dod"
executabledir="${filesdir}"
Expand Down Expand Up @@ -466,6 +467,12 @@ fn_monitorserver(){
fn_rootcheck
fn_syscheck
fn_autoip
if [ ! -f ${lockselfname} ]; then
fn_printinfo "Monitoring ${servicename}: No lock file found: Monitor disabled"
sleep 1
echo -en "\n"
exit
fi
fn_printdots "Monitoring ${servicename}: ${servername}"
sleep 1
fn_scriptlog "Monitoring ${servername}"
Expand Down Expand Up @@ -559,6 +566,8 @@ else
fn_printok "Stopping ${servicename}: ${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f ${lockselfname}
sleep 1
echo -en "\n"
}
Expand All @@ -584,6 +593,8 @@ if [ ${tmuxwc} -eq 1 ]; then
fn_scriptlog "${servername} is already running"
exit
fi
# Create lock file
lockfile -r 0 ${lockselfname}
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}|tee -a '${consolelog}'"
sleep 1
Expand Down Expand Up @@ -618,7 +629,7 @@ echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
if [ "${engine}" = "source" ]; then
if [ ! -z ${sourcetvport} ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
fi
echo "OUTBOUND Client port ${clientport}"
Expand Down
Loading

0 comments on commit 6b120e2

Please sign in to comment.