integ/tools/engtools/hostdata-collectors/scripts/remote/rstop-engtools.sh
Sun Austin 847cf1e92f Fix linters issue E002 and E003 and linters check (none-voting)
E002 Tab indents
E003 Indent not multiple of 4

Story: 2003366
Task: 24424

Change-Id: Ie063ccfe346489f08c4752adaa344f5919db0378
Signed-off-by: Sun Austin <austin.sun@intel.com>
2018-08-31 04:08:52 +00:00

38 lines
927 B
Bash

#!/bin/bash
# Purpose:
# Remote stop engtools on all blades.
# Define common utility functions
TOOLBIN=$(dirname $0)
. ${TOOLBIN}/engtools_util.sh
if [ $UID -eq 0 ]; then
ERRLOG "Do not start $0 using sudo/root access."
exit 1
fi
# environment for system commands
source /etc/nova/openrc
declare -a BLADES
BLADES=( $(system host-list | awk '(/compute|controller|storage/) {print $4;}') )
LOG "Remote stop engtools on all blades:"
for blade in ${BLADES[@]}; do
if [ "${blade}" == "${HOSTNAME}" ]; then
LOG "stop on $blade:"
sudo service collect-engtools.sh stop
else
ping -c1 ${blade} 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
LOG "stop on $blade:"
ssh -q -t -o StrictHostKeyChecking=no \
${blade} sudo service collect-engtools.sh stop
else
WARNLOG "cannot ping: ${blade}"
fi
fi
done
LOG "done"
exit 0