From 6a84224f8a874b3a05be402e7d82ecec0288dc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 18 Jun 2020 08:45:28 +0200 Subject: [PATCH] Create a temp file if APT upgrade is available --- cluster/apt.check.update.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cluster/apt.check.update.sh b/cluster/apt.check.update.sh index e42987f..7e04ed7 100755 --- a/cluster/apt.check.update.sh +++ b/cluster/apt.check.update.sh @@ -2,7 +2,8 @@ # This script will check if any APT upgrade is available and # will prepare the host in order to apply upgrade with another script -# 1. Disable SGE queue +# 1. Create a temp file +# 2. Disable SGE queue # This script can be call by a cronjob (eg. weekly) # Another script should try to apply upgrades also with cron (eg. hourly) @@ -16,6 +17,8 @@ readonly NBARGS="${#}" ## Export DEBUG for sub-script export DEBUG +readonly APT_TMP_FILE="/tmp/.apt.upgrade" + ## Colors readonly PURPLE='\033[1;35m' readonly RED='\033[0;31m' @@ -118,13 +121,17 @@ main() { # {{{ disable_host_queue_script="${PROGDIR}/disable.host.queue.sh" ## If NO APT package upgrade is available + ### Ensure to remove any temp file related to APT upgrades ### Exit is_apt_upgrade_absent \ + && rm -f -- "${APT_TMP_FILE}" \ && exit 0 ## If APT package upgrade is available + ### Create a temp file ### Disable SGE queue is_apt_upgrade_present \ + && touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \ && sh "${disable_host_queue_script}" \ && exit 0