blob: a3752fd8939d42cc2f44ec35bcf522486b044b18 (
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
|
#!/bin/sh
FLAG="${4}/key/flag.$(basename ${0})"
case "${1}" in
startup)
# create flag directory (using cache directory)
mkdir -p "${4}/key/"
# delete flag
rm -f "${FLAG}"
;;
running)
# we are interested in Key "1"
if [ "${2}" = "1" ]; then
if [ -f "${FLAG}" ]; then
# here we do our "off" action
logger -t "uactivity [key/$(basename ${0})]" "$(basename ${0}) off"
rm -f "${FLAG}"
else
# here we do our "on" action
logger -t "uactivity [key/$(basename ${0})]" "$(basename ${0}) on"
# do not use names starting with [0-9][0-9] for data files
touch "${FLAG}"
fi
fi
;;
esac
exit 0
|