From 78be3391b04212fbe19974979d64295275ada988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 22 Jun 2020 11:13:03 +0200 Subject: [PATCH] =?UTF-8?q?Prepare=20the=20host=20before=20upgrade=20(forb?= =?UTF-8?q?id=20SSH,=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/apt.apply.update.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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,…)