upgrade-mattermost.sh: deaktivate crontab while upgrading..

This commit is contained in:
Christoph 2022-06-11 03:26:14 +02:00
parent 75b89b8912
commit de8cd1cde3

View File

@ -18,6 +18,21 @@ backup_date="$(date +%Y-%m-%d-%H%M)"
clean_up() {
if [[ -f "$_backup_crontab_file" ]]; then
echononl "(Re)Install previously saved crontab from '$_backup_crontab_file'.."
crontab $_backup_crontab_file >> $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
fi
# Perform program exit housekeeping
rm -rf "$LOCK_DIR"
blank_line
@ -504,6 +519,29 @@ else
echo_skipped
fi
# - Deaktiviere Cronjobs
# -
_backup_crontab_file=/tmp/crontab_root.${backup_date}
echononl "Backup Crontab to '$_backup_crontab_file'"
crontab -l > $_backup_crontab_file 2> $log_file
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
echononl "Remove crontab for root.."
crontab -r > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
echononl "Extract the Mattermost Server files into TMP directory.."
tar -xf ${working_dir}/mattermost-${MM_NEW_VERSION}-linux-amd64.tar.gz \
-C ${MATTERMOST_TMP_DIR} --transform='s,^[^/]\+,\0-upgrade,'