summaryrefslogtreecommitdiffstats
path: root/minikrebs/profiles/nfc-login/customfiles/usr/bin/login-manager
blob: bcf2072b345230213610156f4db6430cbff47bd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
#LOGIN_HOST=heidi.shack
LOGIN_HOST=heidi:5000
while sleep 1;
do
    uid=$(nfc-list | grep UID | cut -d: -f 2 | sed 's/ //g')
    if ! [ x"$uid" = x ];then
        online=$(wget -O- http://$LOGIN_HOST/user/$uid/online 2>/dev/null)
        if [ "$online" = "false" ];then
            action="login"
        else
            action="logout"
        fi
        wget -O- http://$LOGIN_HOST/user/$uid/$action &>/dev/null
        echo $uid $action
        sleep 5
    fi
done