#!/bin/bash # LGSM fn_stop function # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk # Version: 210115 # Description: Stops the server. local modulename="Stopping" fn_check_root fn_check_systemdir fn_details_config fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 fn_check_tmux pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") if [ "${pid}" == "0" ]; then fn_printfail "${servername} is already stopped" fn_scriptlog "${servername} is already stopped" else tmux kill-session -t ${servicename} fn_printok "${servername}" fn_scriptlog "Stopped ${servername}" fi # Remove lock file rm -f "${lockselfname}" sleep 1 echo -en "\n"