You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/bash
|
|
|
|
#Agent HeartBeat Fail alert mail.
|
|
|
|
#To solve the problem, you can run this script to the agent server in anywhere.
|
|
|
|
|
|
|
|
kid=$(ps -ef | grep java | grep -v grep | awk '{print $2}')
|
|
|
|
if [ -z "$(ps -ef | grep java | grep -v grep)" ]
|
|
|
|
then
|
|
|
|
echo "wait 5 seconds ..."
|
|
|
|
sleep 5s
|
|
|
|
nohup java -jar /var/monitor_agent/agentMain.jar /var/monitor_agent/conf 2>&1 > /dev/null &
|
|
|
|
if [ $? == 0 ]
|
|
|
|
then
|
|
|
|
echo "The agent have started successfully!"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
kill -9 $kid
|
|
|
|
if [ $? == 0 ]
|
|
|
|
then
|
|
|
|
echo "wait 1 minutes ..."
|
|
|
|
sleep 1m
|
|
|
|
echo "Starting agent ..."
|
|
|
|
nohup java -jar /var/monitor_agent/agentMain.jar /var/monitor_agent/conf 2>&1 > /dev/null &
|
|
|
|
if [ $? == 0 ]
|
|
|
|
then
|
|
|
|
echo "The agent have started successfully!"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Failed to kill, please try again later."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "####################################"
|
|
|
|
ps -ef | grep java | grep -v grep
|