Make the name of the log file produced by launch script configurable

Previously, the launch script would always use a file named
<appname>.log to capture the application's console output. This commit
adds a variable, LOG_FILENAME, for specifying the file name defaulting
to <appname>.log.

Fixes gh-4194
This commit is contained in:
Tommy Ludwig 2015-10-15 20:30:23 +09:00 committed by Andy Wilkinson
parent fd525077bd
commit e4230e61d7
2 changed files with 6 additions and 2 deletions

View File

@ -427,6 +427,9 @@ the default behavior in a script or on the command line:
|`LOG_FOLDER`
|The name of the folder to put log files in (`/var/log` by default).
|`LOG_FILENAME`
|The name of the log file in the `LOG_FOLDER` (`<appname>.log` by default).
|`APP_NAME`
|The name of the app. If the jar is run from a symlink the script guesses the app name,
but if it is not a symlink, or you want to explicitly set the app name this can be

View File

@ -61,7 +61,8 @@ if [[ -z "$identity" ]]; then
fi
fi
# Initialize log file name if not provided by the config file
[[ -z "$LOG_FILENAME" ]] && LOG_FILENAME="${identity}.log"
# ANSI Colors
@ -91,7 +92,7 @@ if [[ "$identity" == "$init_script" ]] || [[ "$identity" == "$APP_NAME" ]]; then
PID_FOLDER="$PID_FOLDER/${identity}"
fi
pid_file="$PID_FOLDER/${identity}.pid"
log_file="$LOG_FOLDER/${identity}.log"
log_file="$LOG_FOLDER/$LOG_FILENAME"
# Determine the user to run as if we are root
[[ $(id -u) == "0" ]] && run_user=$(ls -ld "$jarfile" | awk '{print $3}')