16 lines
456 B
Bash
Executable file
16 lines
456 B
Bash
Executable file
#!/bin/sh
|
|
|
|
[ -r ./conf ] && . ./conf
|
|
|
|
TIME_OPTS='-S \"09:00\" -s \"21:00\" -d \"3600\"'
|
|
if command -v curl >/dev/null 2>&1; then
|
|
loc=$(curl -s ipinfo.io | grep -e '"loc": ' | sed -e 's/^.*"loc": "\(.*\)",$/\1/')
|
|
if [ -n "$loc" ]; then
|
|
lat="$(echo "$loc" | cut -d, -f1)"
|
|
long="$(echo "$loc" | cut -d, -f2)"
|
|
TIME_OPTS="-l \"$lat\" -L \"$long\""
|
|
fi
|
|
fi
|
|
|
|
exec 2>&1
|
|
exec chpst -e "$TURNSTILE_ENV_DIR" wlsunset $TIME_OPTS "$@"
|