Files
metal/mtce-common/cgts-mtce-common-1.0/rmon/scripts/rmon_reload_on_cpe.sh
Sun Austin fedb95ba79 Fix linters issues and enable tox/zuul linters job as gate
Fix below linters issues
 E001 Trailing Whitespace
 E003 Indent not multiple of 4
 E006 Line too long
 E011 Then keyword is not on same line as if or elif keyword
 E020 Function declaration not in format ^function name {$
 E040 Syntax error: syntax error near unexpected token `;'

ignore cases are added in tox setup
 E006 Line too long
 E010: do not on the same line as for

Story: 2003368
Task: 24427

Change-Id: I6acf64271a4e608be8bc8fa965cac4fa31e0c05b
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-09-05 09:02:25 +08:00

48 lines
1.2 KiB
Bash

#!/bin/bash
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
source "/etc/init.d/log_functions.sh"
# is it a compute subfunction on a CPE system
isCompute ()
{
[ -f /etc/platform/platform.conf ] || return 0
res=$(grep "subfunction" /etc/platform/platform.conf | grep "controller,compute" | wc -l)
if [ "$res" -eq 0 ] ; then
return 0
else
return 1
fi
}
# only reload rmon if it is a CPE system
isCompute
if [[ "$?" -eq 0 ]]; then
log "Cannot run on a non CPE system."
exit 0
fi
if [ ! -f /var/run/.compute_config_complete ]; then
log "Cannot run prior to compute configuration complete."
exit 0
fi
#################################################################################################
# Temporarily switch this to a process kill instead of reload due to a problem found
# in the rmon config reload handling. A clone Jira was created to track the fix that will migrate
# this back to a reload.
#################################################################################################
# rc=`pkill -hup rmond`
# log "rmond config reload (rc=$rc)"
/usr/local/sbin/pmon-restart rmond
logger "requesting graceful rmon restart in goenabled test on cpe"
exit 0