diff --git a/functions/fn_monitor b/functions/fn_monitor index 9798a6225..19c094481 100644 --- a/functions/fn_monitor +++ b/functions/fn_monitor @@ -16,7 +16,7 @@ fn_logs fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -if [ ! -f "${lockselfname}" ]; then +if [ ! -f "${rootdir}/${lockselfname}" ]; then fn_printinfo "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 @@ -61,7 +61,7 @@ fn_details_config fn_printdots "${servername}" fn_scriptlog "${servername}" sleep 1 -if [ ! -f "${lockselfname}" ]; then +if [ ! -f "${rootdir}/${lockselfname}" ]; then fn_printinfo "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 diff --git a/functions/fn_monitor_query b/functions/fn_monitor_query index f9a888bff..329d49765 100644 --- a/functions/fn_monitor_query +++ b/functions/fn_monitor_query @@ -8,7 +8,7 @@ # Detects if the server has frozen. local modulename="Monitor" -if [ -f gsquery.py ]; then +if [ -f "${rootdir}/gsquery.py" ]; then if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then gameport=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:]) port=$((${gameport} + 1)) @@ -27,7 +27,7 @@ if [ -f gsquery.py ]; then fn_printdots "Querying port: ${ip}:${port} : QUERYING" fn_scriptlog "Querying port: ${ip}:${port} : QUERYING" sleep 1 - serverquery=$(./gsquery.py -a ${ip} -p ${port} -e ${engine} 2>&1) + serverquery=$(${rootdir}/gsquery.py -a ${ip} -p ${port} -e ${engine} 2>&1) exitcode=$? if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then fn_printfail "Querying port: ${ip}:${port} : ${serverquery}" @@ -64,21 +64,21 @@ if [ -f gsquery.py ]; then echo -en "\n" exit elif [ "${exitcode}" == "126" ]; then - fn_printfail "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied" - fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied" + fn_printfail "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied" + fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied" sleep 1 echo -en "\n" echo "Attempting to resolve automatically" - chmod +x -v gsquery.py + chmod +x -v "${rootdir}/gsquery.py" exitcode=$? if [ "${exitcode}" == "0" ]; then fn_monitor_query else fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n" - owner=$(ls -al gsquery.py|awk '{ print $3 }') + owner=$(ls -al ${rootdir}/gsquery.py|awk '{ print $3 }') echo "As user ${owner} or root run the following command." whoami=$(whoami) - echo -en "\nchown ${whoami}:${whoami} gsquery.py\n\n" + echo -en "\nchown ${whoami}:${whoami} ${rootdir}/gsquery.py\n\n" exit fi else @@ -86,7 +86,10 @@ if [ -f gsquery.py ]; then fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR" sleep 1 echo -en "\n" - ./gsquery.py -a ${ip} -p ${port} -e ${engine} + ${rootdir}/gsquery.py -a ${ip} -p ${port} -e ${engine} exit fi -fi \ No newline at end of file +else + fn_printfail "Could not find ${rootdir}/gsquery.py" + fn_scriptlog "Could not find ${rootdir}/gsquery.py" +fi