diff --git a/Rust/rustserver b/Rust/rustserver index 9557f914d..513f6b967 100644 --- a/Rust/rustserver +++ b/Rust/rustserver @@ -39,7 +39,7 @@ tickrate="30" # default 30; range : 15 to 100 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters fn_parms(){ -parms="-batchmode +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${servicename}\" ${conditionalseed} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile ${gamelogfile}" +parms="-batchmode +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${servicename}\" ${conditionalseed} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile \"${gamelogdate}\"" } # Specific to Rust @@ -132,7 +132,6 @@ backupdir="${rootdir}/backups" gamelogdir="${rootdir}/log/server" scriptlogdir="${rootdir}/log/script" consolelogdir="${rootdir}/log/console" -gamelog="${gamelogdir}/${servicename}-game.log" scriptlog="${scriptlogdir}/${servicename}-script.log" consolelog="${consolelogdir}/${servicename}-console.log" emaillog="${scriptlogdir}/${servicename}-email.log" @@ -140,7 +139,7 @@ emaillog="${scriptlogdir}/${servicename}-email.log" ## Logs Naming scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" -gamelogfile="\"gamelog-$(date '+%Y-%m-%d-%H-%M-%S').log\"" +gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%Y-%m-%d-%H:%M:%S').log" ######################## ######## Script ######## diff --git a/lgsm/functions/check.sh b/lgsm/functions/check.sh index 7cc1e9584..ec067de66 100644 --- a/lgsm/functions/check.sh +++ b/lgsm/functions/check.sh @@ -17,7 +17,7 @@ if [ "${function_selfname}" != "command_monitor.sh" ];then check_permissions.sh fi -if [ "${function_selfname}" != "command_install.sh" ]&&[ "${function_selfname}" != "command_update_functions.sh" ]; then +if [ "${function_selfname}" != "command_install.sh" ]&&[ "${function_selfname}" != "command_update_functions.sh" ]&&[ "${function_selfname}" != "command_details.sh" ]&&[ "${function_selfname}" != "command_postdetails.sh" ]; then check_system_dir.sh fi @@ -53,7 +53,7 @@ do fi done -local allowed_commands_array=( command_console.sh command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh ) +local allowed_commands_array=( command_console.sh command_debug.sh command_monitor.sh command_start.sh command_stop.sh ) for allowed_command in "${allowed_commands_array[@]}" do if [ "${allowed_command}" == "${function_selfname}" ]; then diff --git a/lgsm/functions/check_executable.sh b/lgsm/functions/check_executable.sh index 14ccdb060..cc90b435d 100644 --- a/lgsm/functions/check_executable.sh +++ b/lgsm/functions/check_executable.sh @@ -9,9 +9,10 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" # Check if executable exists if [ ! -f "${executabledir}/${execname}" ]; then - fn_script_log_warn "Expected executable not found: ${executabledir}/${execname}" + fn_script_log_warn "Executable was not found: ${executabledir}/${execname}" if [ -d "${scriptlogdir}" ]; then - fn_print_fail_nl "Executable ${execname} was not found" + fn_print_fail_nl "Executable was not found:" + echo " * ${executabledir}/${execname}" fi exitcode="1" core_exit.sh diff --git a/lgsm/functions/check_logs.sh b/lgsm/functions/check_logs.sh index 5e9da586c..bc4f13bdf 100644 --- a/lgsm/functions/check_logs.sh +++ b/lgsm/functions/check_logs.sh @@ -7,11 +7,20 @@ local commandname="CHECK" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" -# Create directories for the script and console logs -if [ ! -d "${scriptlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${gamename}" != "TeamSpeak 3" ]; then +fn_check_logs(){ fn_print_dots "Checking for log files" sleep 0.5 fn_print_info_nl "Checking for log files: Creating log files" checklogs=1 install_logs.sh +} + +# Create directories for the script and console logs +if [ ! -d "${scriptlogdir}" ]||[ ! -d "${consolelogdir}" ]&&[ "${gamename}" != "TeamSpeak 3" ]; then + fn_check_logs +fi + +# Create gamelogdir if variable exist but dir does not exist +if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then + fn_check_logs fi diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index d7bff4dee..24648f2ec 100644 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -232,4 +232,6 @@ fn_sys_perm_error_process(){ ## Run checks fn_check_ownership fn_check_permissions -fn_sys_perm_error_process +if [ "${function_selfname}" == "command_start.sh" ]; then + fn_sys_perm_error_process +fi diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh index bc76a29b2..ad7b76aaf 100644 --- a/lgsm/functions/command_update.sh +++ b/lgsm/functions/command_update.sh @@ -11,7 +11,7 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_print_dots "" sleep 0.5 check.sh - +logs.sh if [ "${gamename}" == "TeamSpeak 3" ]; then update_ts3.sh diff --git a/lgsm/functions/logs.sh b/lgsm/functions/logs.sh index ebcc8636a..44467d82f 100644 --- a/lgsm/functions/logs.sh +++ b/lgsm/functions/logs.sh @@ -16,7 +16,8 @@ if [ -n "${consolelog}" ]; then fi # For games not displaying a console, and having logs into their game directory -if [ "${function_selfname}" == "command_start.sh" ] && [ -n "${gamelogfile}" ]; then +check_status.sh +if [ "${status}" != "0" ] && [ "${function_selfname}" == "command_start.sh" ] && [ -n "${gamelogfile}" ]; then if [ -n "$(find "${systemdir}" -name "gamelog*.log")" ]; then fn_print_info "Moving game logs to ${gamelogdir}" fn_script_log_info "Moving game logs to ${gamelogdir}" @@ -100,10 +101,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}" legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l) find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \; - # Remove directory if empty - if [ ! "$(ls -A "${legacyserverlogdir}")" ]; then - rm -rf "${legacyserverlogdir}" - fi fi # Count total amount of files removed diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 028f843ee..e500a0fbf 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -98,7 +98,11 @@ fn_update_request_log(){ fn_print_dots "Checking for update: Server logs" fn_script_log_info "Checking for update: Server logs" sleep 1 - requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}") + if [ -f ${consolelog} ]; then + requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}") + else + requestrestart="0" + fi if [ "${requestrestart}" -ge "1" ]; then fn_print_ok_nl "Checking for update: Server logs: Update requested" fn_script_log_pass "Checking for update: Server logs: Update requested"