diff --git a/functions/fn_getopt b/functions/fn_getopt index 8138eb0cd..0fc5402b2 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -2,7 +2,7 @@ # LGSM fn_getopt function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 150314 +# Version: 150414 # Description: getopt arguments. @@ -15,16 +15,9 @@ case "$getopt" in restart) fn_restart;; update) - norestart=1; - fn_update_check;; - update-restart) fn_update_check;; validate) fn_validate;; - validate-restart) - fn_stop - fn_validate - fn_start;; monitor) fn_monitor;; email-test) @@ -42,7 +35,7 @@ case "$getopt" in auto-install) fn_autoinstall;; *) - echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}" + echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" exit 1;; esac exit @@ -116,16 +109,9 @@ case "$getopt" in restart) fn_restart;; update) - norestart=1; - fn_update_check;; - update-restart) fn_update_check;; validate) fn_validate;; - validate-restart) - fn_stop - fn_validate - fn_start;; monitor) fn_monitor;; email-test) @@ -145,7 +131,7 @@ case "$getopt" in map-compressor) fn_compress_unreal2maps;; *) - echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" exit 1;; esac exit diff --git a/functions/fn_update_check b/functions/fn_update_check index b5135d61b..d37ce43c6 100644 --- a/functions/fn_update_check +++ b/functions/fn_update_check @@ -2,7 +2,7 @@ # LGSM fn_update_check function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 150315 +# Version: 150415 # Description: Checks if a server update is available. @@ -84,12 +84,13 @@ if [ "${requestrestart}" -ge "1" ]; then echo -ne "Applying update...\r" sleep 1 echo -ne "\n" - if [ ! -z "${norestart}" ]; then - fn_update_dl - else + tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l) + if [ "${tmuxwc}" -eq 1 ]; then fn_stop fn_update_dl fn_start + else + fn_update_dl fi else fn_printok "Checking for update: Server logs: No update requested" @@ -145,12 +146,14 @@ if [ "${currentbuild}" -ne "${availablebuild}" ]; then fn_scriptlog "Current build: ${currentbuild}" fn_scriptlog "Available build: ${availablebuild}" fn_scriptlog "${currentbuild} > ${availablebuild}" - if [ ! -z "${norestart}" ]; then - fn_update_dl - else + + tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l) + if [ "${tmuxwc}" -eq 1 ]; then fn_stop fn_update_dl fn_start + else + fn_update_dl fi else echo -e "\n" diff --git a/functions/fn_validate b/functions/fn_validate index d3e719e1f..bd15f441c 100644 --- a/functions/fn_validate +++ b/functions/fn_validate @@ -2,13 +2,13 @@ # LGSM fn_validate function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 210115 +# Version: 150415 # Description: Runs a server validation. local modulename="Validate" -fn_check_root -fn_check_systemdir + +fn_validation(){ fn_printwarn "Validating may overwrite some customised files." sleep 1 echo -en "\n" @@ -23,4 +23,17 @@ sleep 1 cd "${rootdir}" cd "steamcmd" ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}" -fn_scriptlog "Checking complete" \ No newline at end of file +fn_scriptlog "Checking complete" +} + + +fn_check_root +fn_check_systemdir +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l) +if [ "${tmuxwc}" -eq 1 ]; then + fn_stop + fn_validation + fn_start +else + fn_validation +fi