update/patch-scripts/EXAMPLE_SERVICE/scripts/service-process-restart

55 lines
1.3 KiB
Bash

#!/bin/bash
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This script provides an example in-service patching restart script
# that supports service file changes by issuing a systemctl daemon reload
# after the patch is applied
#
# The patching subsystem provides a patch-functions bash source file
# with useful function and variable definitions.
#
. /etc/patching/patch-functions
#
# Declare an overall script return code
#
declare -i GLOBAL_RC=$PATCH_STATUS_OK
# issue a systemd daemon-reload once the rpms have been installed and before
# the processes have been restarted.
systemctl daemon-reload
# processes that run on all nodes
processes_to_restart="collectd"
/usr/local/sbin/patch-restart-processes ${processes_to_restart}
if [ $? != 0 ] ; then
loginfo "patching restart failed"
loginfo "... process-restart ${processes_to_restart}"
exit ${PATCH_STATUS_FAILED}
fi
# processes that only run on controller hosts
if is_controller
then
processes_to_restart="influxdb"
/usr/local/sbin/patch-restart-processes ${processes_to_restart}
if [ $? != 0 ] ; then
loginfo "patching restart failed"
loginfo "... process-restart ${processes_to_restart}"
exit ${PATCH_STATUS_FAILED}
fi
fi
#
# Exit the script with the overall return code
#
exit $GLOBAL_RC