Skip to content
Snippets Groups Projects
Commit 9e2476a7 authored by an7s's avatar an7s
Browse files

Ping remote host to make sure live

parent 5955e708
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,17 @@ file=$1
md5name=$(md5sum $file | awk '{print $1}')
directory=/tmp/remote-analyze/${md5name}
verify_host_live()
{
remotehost=$1
ping -c 5 -w 5 $remotehost
if [ ! $? -eq 0 ]; then
return 1
fi
return 0
}
copy_STARS_info()
{
remotehost=$1
......@@ -89,18 +100,30 @@ run_remote_command()
# FIXME: need to handle multiple files to be analyzed?
exit_code=1
server_has_cached_info $IDA_PRO_SERVER_HOST
if [ $? -eq 0 ]; then
echo SERVER HAS ALREADY ANALYZED $md5name, retrieving cached info
copy_and_verify_result $remotehost $file.annot
exit_code=$?
verify_host_live $IDA_PRO_SERVER_HOST
if [ $? -eq 0 ]; then
server_has_cached_info $IDA_PRO_SERVER_HOST
if [ $? -eq 0 ]; then
echo SERVER HAS ALREADY ANALYZED $md5name, retrieving cached info
copy_and_verify_result $remotehost $file.annot
exit_code=$?
else
run_remote_command $IDA_PRO_SERVER_HOST $@
exit_code=$?
fi
else
run_remote_command $IDA_PRO_SERVER_HOST $@
exit_code=$?
echo "Host $IDA_PRO_SERVER_HOST is not responding"
fi
if [ ! $exit_code -eq 0 ]; then
echo "Error detected on primary $IDA_PRO_SERVER_HOST, failing over to $IDA_PRO_SERVER_HOST2"
verify_host_live $IDA_PRO_SERVER_HOST2
if [ ! $? -eq 0 ]; then
echo "Backup host $IDA_PRO_SERVER_HOST2 is not responding"
exit 1
fi
run_remote_command $IDA_PRO_SERVER_HOST2 $@
exit_code=$?
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment