Skip to content

Instantly share code, notes, and snippets.

@qichunren
Created June 8, 2012 10:21
Show Gist options
  • Save qichunren/2894867 to your computer and use it in GitHub Desktop.
Save qichunren/2894867 to your computer and use it in GitHub Desktop.
send status info to target server.
#!/bin/bash
server_ip=`route | grep default | awk '{print $2}'`
client_name=`cat /etc/hostname`
mac_address=`ifconfig -a | grep eth0 | awk '{print $5}'`
# echo $server_ip
#if [ -n $1 ]; then
# echo "Argument error, usage: ./ping.sh your_ip"
# exit 1
#fi
for (( ; ; ))
do
echo "ping server ..."
curl --connect-timeout 5 "http://$server_ip:4567/ping?client_name=$client_name&mac=$mac_address"
sleep 20
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment