updater: combine installer logs into the task file
This commit is contained in:
+8
-10
@@ -14,8 +14,8 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "sourceDir argument required"
|
||||
if [[ $# != 2 ]]; then
|
||||
echo "Usage: update.sh <sourceDir> <logFile> arguments required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -24,19 +24,17 @@ function log() {
|
||||
}
|
||||
|
||||
readonly source_dir="${1}"
|
||||
readonly log_file="${2}"
|
||||
|
||||
readonly installer_path="${source_dir}/scripts/installer.sh"
|
||||
readonly ubuntu_version=$(lsb_release -rs)
|
||||
|
||||
log "updating Cloudron with ${source_dir}"
|
||||
|
||||
systemctl reset-failed "${updater_service}" 2>/dev/null || true
|
||||
|
||||
# StandardError will follow StandardOutput in default inherit mode. https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
readonly DATETIME=`date '+%Y-%m-%d_%H-%M-%S'`
|
||||
readonly LOG_FILE="/home/yellowtent/platformdata/logs/updater/cloudron-updater-${DATETIME}.log"
|
||||
|
||||
log "starting service ${updater_service}. see logs at ${LOG_FILE}"
|
||||
|
||||
if ! systemd-run --property=OOMScoreAdjust=-1000 --unit "${updater_service}" -p StandardOutput=file:${LOG_FILE} ${installer_path}; then
|
||||
systemctl reset-failed "${updater_service}" 2>/dev/null || true
|
||||
[[ "${ubuntu_version}" == "18.04" ]] && file_mode="file" || file_mode="append"
|
||||
if ! systemd-run --property=OOMScoreAdjust=-1000 --unit "${updater_service}" -p StandardOutput=${file_mode}:${log_file} ${installer_path}; then
|
||||
log "Failed to install cloudron"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user