for host in $(cat /home/xyz/cron_scripts/VMHFList.txt)
do
usage=$(ssh -q -t $host 'df -h | grep "/opt/splunk" | awk '"'"'{print $5}'"'"' | cut -d % -f1')
echo "Machine name: $( echo $host | cut -d'@' -f2 ) splunk file system is $usage"
echo $usage
if [[ "$usage" -gt "0" && "$usage" -le "50" ]];
then
echo " Splunk usage in $host is minimal "
elif [[ "$usage" -gt "50" && "$usage" -le "75" ]];
then
echo "out of limits"
ssh -q -t $host 'sudo /home/xyz/scripts_for_SDC/VMremove_old_data.sh 1440'
elif [[ "$usage" -gt "75" && "$usage" -le "90" ]];
then
echo "the splunk disk space is between 76 to 90%"
ssh -q -t $host 'sudo /home/xyz/scripts_for_SDC/VMremove_old_data.sh 720'
elif [[ "$usage" -gt "90" && "$usage" -le "100" ]];
then
echo "when the hard disk space above 90%"
ssh -q -t $host 'sudo /home/xyz/scripts_for_SDC/VMremove_old_data.sh 360'
fi
done
运行我的shell脚本时出现语法错误。 “)语法错误:无效的算术运算符(错误标记为“ -gt 50]]