Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 24 lines (18 sloc) 0.424 kb
aa7b953 @kaihendry chroot
kaihendry authored
1 #!/bin/sh
6f7c35c ping add mac_address
root authored
2 . /etc/webc/webc.conf
3 server="http://ping.webconverger.org/"
aa7b953 @kaihendry chroot
kaihendry authored
4 sleeping=5
5
9269bf8 @kaihendry Ensure ping is only run once
kaihendry authored
6 webcping () {
6f7c35c ping add mac_address
root authored
7 logger "Pinging $server"
8 wget -qO- --timeout=5 --post-data="M=$(
9 mac_address | md5sum | awk '{print $1}'
1fb4f60 @kaihendry Use mkdir to lock
kaihendry authored
10 )&V=${webc_version}" "$server"
aa7b953 @kaihendry chroot
kaihendry authored
11 }
12
8d555ac @kaihendry simplify by only using /var/run however introducing possible race con…
kaihendry authored
13 lockdir=/var/run/webcping
14 test -f "$lockdir" && exit 0
15 touch "$lockdir"
9269bf8 @kaihendry Ensure ping is only run once
kaihendry authored
16
8d555ac @kaihendry simplify by only using /var/run however introducing possible race con…
kaihendry authored
17 while ! webcping
aa7b953 @kaihendry chroot
kaihendry authored
18 do
6f7c35c ping add mac_address
root authored
19
20 logger "Failed to ping $server, sleeping $sleeping seconds"
1fb4f60 @kaihendry Use mkdir to lock
kaihendry authored
21 sleep "$sleeping"
aa7b953 @kaihendry chroot
kaihendry authored
22
23 done &
Something went wrong with that request. Please try again.