Create a temp file if APT upgrade is available
This commit is contained in:
parent
448f71d4cc
commit
6a84224f8a
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
# This script will check if any APT upgrade is available and
|
# This script will check if any APT upgrade is available and
|
||||||
# will prepare the host in order to apply upgrade with another script
|
# 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)
|
# This script can be call by a cronjob (eg. weekly)
|
||||||
# Another script should try to apply upgrades also with cron (eg. hourly)
|
# 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 for sub-script
|
||||||
export DEBUG
|
export DEBUG
|
||||||
|
|
||||||
|
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
readonly PURPLE='\033[1;35m'
|
readonly PURPLE='\033[1;35m'
|
||||||
readonly RED='\033[0;31m'
|
readonly RED='\033[0;31m'
|
||||||
|
@ -118,13 +121,17 @@ main() { # {{{
|
||||||
disable_host_queue_script="${PROGDIR}/disable.host.queue.sh"
|
disable_host_queue_script="${PROGDIR}/disable.host.queue.sh"
|
||||||
|
|
||||||
## If NO APT package upgrade is available
|
## If NO APT package upgrade is available
|
||||||
|
### Ensure to remove any temp file related to APT upgrades
|
||||||
### Exit
|
### Exit
|
||||||
is_apt_upgrade_absent \
|
is_apt_upgrade_absent \
|
||||||
|
&& rm -f -- "${APT_TMP_FILE}" \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
|
|
||||||
## If APT package upgrade is available
|
## If APT package upgrade is available
|
||||||
|
### Create a temp file
|
||||||
### Disable SGE queue
|
### Disable SGE queue
|
||||||
is_apt_upgrade_present \
|
is_apt_upgrade_present \
|
||||||
|
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
|
||||||
&& sh "${disable_host_queue_script}" \
|
&& sh "${disable_host_queue_script}" \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue