Prepare the host before upgrade (forbid SSH,…)

This commit is contained in:
Jeremy Gardais 2020-06-22 11:13:03 +02:00
parent 872bb98950
commit 78be3391b0
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 14 additions and 2 deletions

View File

@ -5,7 +5,7 @@
# 2. No SGE jobs are running # 2. No SGE jobs are running
# 3. No process related to Maco are running # 3. No process related to Maco are running
# This script can be call by a cronjob (eg. hourly) # This script can be called by a cronjob (eg. hourly)
# Vars {{{ # Vars {{{
readonly PROGNAME=$(basename "${0}") readonly PROGNAME=$(basename "${0}")
@ -260,6 +260,15 @@ procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on t
return "${return_proc_running}" return "${return_proc_running}"
}
# }}}
prepare_host() { # {{{
debug_message "prepare_host \
Forbid SSH logins,…".
touch /etc/nologin
} }
# }}} # }}}
upgrade_system() { # {{{ upgrade_system() { # {{{
@ -277,7 +286,7 @@ clean_host() { # {{{
Try to clean temp files, downloaded packages,…". Try to clean temp files, downloaded packages,…".
aptitude clean >> "${APT_TMP_FILE}" 2>&1 \ aptitude clean >> "${APT_TMP_FILE}" 2>&1 \
&& rm -f -- "${APT_TMP_FILE}" && rm -f -- "${APT_TMP_FILE}" /etc/nologin
} }
# }}} # }}}
@ -312,6 +321,9 @@ main() { # {{{
is_proc_running "${maco_proc_pattern}" \ is_proc_running "${maco_proc_pattern}" \
&& exit 0 && exit 0
## Prepare the host for upgrade
prepare_host
## Try to upgrade the system ## Try to upgrade the system
### If error: Exit 50 ### If error: Exit 50
### If success: Clean host (temp files, download,…) ### If success: Clean host (temp files, download,…)