Browse Source
If the administrator stops the server using the stop command the monitor will disable itself preventing the server from starting back up on its ownpull/103/head
19 changed files with 249 additions and 47 deletions
@ -3,7 +3,7 @@ |
|||
# Server Management Script |
|||
# Author: Daniel Gibbs |
|||
# Website: http://danielgibbs.co.uk |
|||
# Version: 050214 |
|||
# Version: 220614 |
|||
|
|||
#### Variables #### |
|||
|
|||
@ -15,6 +15,7 @@ email="[email protected]" |
|||
# Directorys |
|||
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|||
selfname="$0" |
|||
lockselfname=$(echo "${selfname}.lock"|sed 's/^\(.\{1\}\).\(.*\)/\1\2/') |
|||
filesdir="${rootdir}/serverfiles" |
|||
systemdir="${filesdir}/System" |
|||
executabledir="${systemdir}" |
|||
@ -445,6 +446,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}" |
|||
@ -506,6 +513,8 @@ else |
|||
fn_printok "Stopping ${servicename}: ${servername}" |
|||
fn_scriptlog "Stopped ${servername}" |
|||
fi |
|||
# Remove lock file |
|||
rm -f ${lockselfname} |
|||
sleep 1 |
|||
echo -en "\n" |
|||
} |
|||
@ -531,6 +540,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 |
|||
|
Loading…
Reference in new issue