diff --git a/pzserver/pzenv b/pzserver/pzenv index 0ffa6e0..5054b99 100644 --- a/pzserver/pzenv +++ b/pzserver/pzenv @@ -58,7 +58,6 @@ PZSERVERSTART="${PZSERVER}/start-server.sh" PZSERVERSANDBOX="${PZSERVERDIR}/servertest_SandboxVars.lua" PZSERVERSPAWNPOINTS="${PZSERVERDIR}/servertest_spawnpoints.lua" PZSERVERSPAWNREGIONS="${PZSERVERDIR}/servertest_spawnregions.lua" -PZSERVERLOCK="${CACHEDIR}/pzserver.${USER}.lock" JAVAMODSVERSION=0.0.1 JAVAMODSARCHIVE="javamods-${JAVAMODSVERSION}.zip" @@ -230,26 +229,10 @@ check_not_running() { fi } -search_pz_pid() { - - while read PROC; do - - grep -l 'ProjectZomboid' "${PROC}/comm" 2> /dev/null | cut -f3 -d/ - - done < <(find /proc -maxdepth 1 -type d -user "${USER}") -} - get_pz_pid() { - - PIDS=$(search_pz_pid) - for PID in ${PIDS[@]}; do - - LINK="$(readlink "/proc/${PID}/fd/0")" - if [ "${LINK}" != '/dev/null' ]; then - echo $PID - fi - - done + if pgrep ProjectZomboid -u ${USER} > /dev/null 2>&1; then + echo $(pgrep ProjectZomboid -u ${USER}) + fi } ask_confirmation() { diff --git a/pzserver/pzstart b/pzserver/pzstart index e6e255b..a6a1ecf 100755 --- a/pzserver/pzstart +++ b/pzserver/pzstart @@ -8,7 +8,7 @@ check_not_running check_first_time -detach flock -n "${PZSERVERLOCK}" "$(dirname "${0}")/pzstartloop" ${ADMINUSEROPTION} ${ADMINPASSWDOPTION} ${@} & +detach "$(dirname "${0}")/pzstartloop" ${ADMINUSEROPTION} ${ADMINPASSWDOPTION} ${@} & sleep 0.5 diff --git a/pzserver/pzstartloop b/pzserver/pzstartloop index 3e8ff7a..94c73a3 100755 --- a/pzserver/pzstartloop +++ b/pzserver/pzstartloop @@ -12,8 +12,6 @@ while true; do [[ -f "${PZSERVERLOG}" ]] && cp "${PZSERVERLOG}" "${PZSERVERLOG}.old" - pzlinkmaps - pzwrap "${PZSERVERSTART}" ${@} &> /dev/null if [ "${?}" != '0' ]; then diff --git a/pzserver/pzstatus b/pzserver/pzstatus index 66dc587..8e541e4 100755 --- a/pzserver/pzstatus +++ b/pzserver/pzstatus @@ -4,7 +4,6 @@ check_is_pzserver_user -flock -n "${PZSERVERLOCK}" echo > /dev/null if [ "${?}" = '0' ] && [ -z "$(get_pz_pid)" ]; then echo Status: Not running