-
Notifications
You must be signed in to change notification settings - Fork 0
/
keep.sh
executable file
·62 lines (53 loc) · 947 Bytes
/
keep.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
cameraIP=camera.u-suke.org
commands () {
cat <<EOS
start
stop
start_with_keepalive
keepalive
commands
help
EOS
}
getUrlContents () {
curl "$@"
}
usage () {
cat <<EOS
$(basename $0) [$(commands | xargs | sed -e 's/ /|/g')]
EOS
}
start () {
getUrlContents "http://$cameraIP/cam.cgi?mode=accctrl&type=req_acc&value=0&value2=lumix-webcam"
getUrlContents "http://$cameraIP/cam.cgi?mode=camcmd&value=recmode"
getUrlContents "http://$cameraIP/cam.cgi?mode=startstream&value=49199&value2=10"
}
stop () {
getUrlContents "http://$cameraIP/cam.cgi?mode=stopstream"
}
interrupt () {
stop
exit
}
keepalive () {
while true
do
getUrlContents "http://$cameraIP/cam.cgi?mode=getstate"
getUrlContents "http://$cameraIP/cam.cgi?mode=camctrl&type=touch&value=500/500&value2=on"
sleep 10
done
}
trap interrupt SIGINT
case $1 in
start|stop|keepalive)
$1
;;
start_with_keepalive)
start
keepalive
;;
*)
usage
;;
esac