Merge "Add failure checks to patching init script"
This commit is contained in:
commit
2fc8ef2f21
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
# Copyright (c) 2014-2019 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -14,6 +14,7 @@ NAME=$(basename $0)
|
||||||
. /etc/platform/platform.conf
|
. /etc/platform/platform.conf
|
||||||
|
|
||||||
logfile=/var/log/patching.log
|
logfile=/var/log/patching.log
|
||||||
|
patch_failed_file=/var/run/patch_install_failed
|
||||||
|
|
||||||
function LOG_TO_FILE {
|
function LOG_TO_FILE {
|
||||||
echo "`date "+%FT%T.%3N"`: $NAME: $*" >> $logfile
|
echo "`date "+%FT%T.%3N"`: $NAME: $*" >> $logfile
|
||||||
|
@ -89,6 +90,7 @@ if [ ${FOUND} -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
RC=0
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ "${system_mode}" = "simplex" ]; then
|
if [ "${system_mode}" = "simplex" ]; then
|
||||||
|
@ -99,6 +101,10 @@ case "$1" in
|
||||||
|
|
||||||
LOG_TO_FILE "***** Starting patch operation *****"
|
LOG_TO_FILE "***** Starting patch operation *****"
|
||||||
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
||||||
|
if [ -f ${patch_failed_file} ]; then
|
||||||
|
RC=1
|
||||||
|
LOG_TO_FILE "***** Patch operation failed *****"
|
||||||
|
fi
|
||||||
LOG_TO_FILE "***** Finished patch operation *****"
|
LOG_TO_FILE "***** Finished patch operation *****"
|
||||||
|
|
||||||
LOG_TO_FILE "***** Shutting down lighttpd *****"
|
LOG_TO_FILE "***** Shutting down lighttpd *****"
|
||||||
|
@ -112,6 +118,10 @@ case "$1" in
|
||||||
|
|
||||||
LOG_TO_FILE "***** Starting patch operation *****"
|
LOG_TO_FILE "***** Starting patch operation *****"
|
||||||
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
||||||
|
if [ -f ${patch_failed_file} ]; then
|
||||||
|
RC=1
|
||||||
|
LOG_TO_FILE "***** Patch operation failed *****"
|
||||||
|
fi
|
||||||
LOG_TO_FILE "***** Finished patch operation *****"
|
LOG_TO_FILE "***** Finished patch operation *****"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -123,6 +133,10 @@ case "$1" in
|
||||||
restart)
|
restart)
|
||||||
LOG_TO_FILE "***** Starting patch operation *****"
|
LOG_TO_FILE "***** Starting patch operation *****"
|
||||||
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
/usr/sbin/sw-patch-agent --install 2>>$logfile
|
||||||
|
if [ -f ${patch_failed_file} ]; then
|
||||||
|
RC=1
|
||||||
|
LOG_TO_FILE "***** Patch operation failed *****"
|
||||||
|
fi
|
||||||
LOG_TO_FILE "***** Finished patch operation *****"
|
LOG_TO_FILE "***** Finished patch operation *****"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -130,5 +144,5 @@ case "$1" in
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit $RC
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue