I created a simple script in bash to start system service if system is down for more than threshold value.If part basically check the integer value(extracted from the commnd)with threshold value(integer)
control is not going to if statement. can anyone suggest me the solution for above. how to test integer expression in IF statement.
function#!/bin/bash
**function start_repair {
threshold=120
IP=10.194.51.216
echo "$((systemctl status cassandra | awk'/(Active:failed)/{print$10}')| awk '{print ($0+0)}')"
if [[ "$((systemctl status cassandra | awk '/(Active: failed)/{print $10}') | awk '{print ($0+0)}')" -gt "${threshold}" ]]; then
echo "greater than ${threshold}"
service cassandra restart
PID=$!
wait $PID
echo done
fi
}**
ERROR: bash: line 5: [: : integer expression expected