From 301cb7cd3c975e47f2d69adb5052e643f467b3c9 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 16 Nov 2015 14:53:30 +0100 Subject: [PATCH] MT#16387 Report pending requested reboots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are some times when a configuration, service or system upgrade requires a reboot to take effect. When a component requires a reboot, it will record this fact in the file system through the file «/var/run/reboot-required», and «ngcpcfg status» will notify the user that a reboot has been requested. We use the «/var/run/reboot-required» because it is already being used in the unattended-upgrades package on Debian/Ubuntu which does something similar. Change-Id: I43997bfb83892f67bd57bb55ad3ec0a41a5e088d --- etc/ngcp-config/ngcpcfg.cfg | 3 +++ scripts/status | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/etc/ngcp-config/ngcpcfg.cfg b/etc/ngcp-config/ngcpcfg.cfg index ae8350d6..3841252f 100644 --- a/etc/ngcp-config/ngcpcfg.cfg +++ b/etc/ngcp-config/ngcpcfg.cfg @@ -32,6 +32,9 @@ TIME_FORMAT="+%F %T" # directory holding files for internal state of ngcpcfg TIMESTAMP_DIR='/var/lib/ngcpcfg/timestamps/' +# Run-time state directory +RUN_DIR='/var/run' + # validate configs using kwalify schema VALIDATE_SCHEMA="false" ## END OF FILE ################################################################# diff --git a/scripts/status b/scripts/status index bdf51d34..d2d3e3bb 100755 --- a/scripts/status +++ b/scripts/status @@ -147,12 +147,26 @@ check_pending_actions() { fi } +check_reboot_requests() { + log_debug "check_requested_reboot" + + log_info "Checking for pending reboot requests:" + + if [ -f "${RUN_DIR}/reboot-required" ]; then + log_info "ACTION_NEEDED: configuration, service or system changes requested a reboot" + log_info "-> reboot the system at your earliest convenience" + else + log_info "OK: no reboot requested" + fi +} + if [ -z "${1:-}" ] ; then check_local_state check_push check_etc_state check_pending_actions check_shared_storage "$@" + check_reboot_requests fi check_remote "$@"