diff --git a/cluster/apt.apply.update.sh b/cluster/apt.apply.update.sh index d8a5cf9..5ff8c7e 100755 --- a/cluster/apt.apply.update.sh +++ b/cluster/apt.apply.update.sh @@ -5,7 +5,7 @@ # 2. No SGE jobs 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 {{{ 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}" +} +# }}} +prepare_host() { # {{{ + + debug_message "prepare_host − \ +Forbid SSH logins,…". + + touch /etc/nologin + } # }}} upgrade_system() { # {{{ @@ -277,7 +286,7 @@ clean_host() { # {{{ Try to clean temp files, downloaded packages,…". 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}" \ && exit 0 + ## Prepare the host for upgrade + prepare_host + ## Try to upgrade the system ### If error: Exit 50 ### If success: Clean host (temp files, download,…)