summaryrefslogtreecommitdiff
path: root/files/common/etc/fsm/inetable/watch/ghost
blob: 54696f2e1aac64f5e0b2e8f8d6e75d27ca053fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh -e
. ../common.sh
. ../common_queen.sh

# if our GW IP has been taken we must no use it again
if ! we_own_our_ip; then
    if ! cloud_is_online; then
	echo robinson
    else
	echo drone
    fi
    exit
fi

if test_connectivity internet; then
    echo queen
    exit
fi

if [ "$1" == "ghost" ]; then
    GhostTime=$(($(date +%s) - $(cat /tmp/ghost_since)))
else
    GhostTime=0
fi
if ! cloud_is_online; then
    echo robinson
elif [ $GhostTime -ge $DHCPLeaseTime ]; then
    echo drone
else
    echo ghost
fi
contact: Jan Huwald // Impressum