change order of startup check

This commit is contained in:
mmaster 2020-09-26 13:20:59 +02:00
parent 49094e4347
commit 02e45dd261
1 changed files with 13 additions and 13 deletions

View File

@ -20,15 +20,6 @@ if [ -z "$(command -v $player)" ]; then
exit 1
fi
folder="$(jq -r ".RandomVideo | .folder" < $configfile)"
playerparam="$(jq -r ".playerparam" < $configfile)"
pgrepplayer="$(jq -r ".pgrepplayer" < $configfile)"
swupgpio="$(jq -r ".swupgpio" < $configfile)"
playerfull="$(command -v $player) $playerparam"
swupstat="$(gpio read $swupgpio)"
if [ $# -eq 0 ]; then
echo "Missing parameter!"
exit 1
@ -39,15 +30,24 @@ if [ $# -gt 1 ]; then
exit 1
fi
if [ "$swupstat" -eq 1 ]; then
exit 1
fi
if [ "buzzer" != "$1" ] && [ "cron" != "$1" ]; then
echo "parameters must be \"buzzer\" or \"cron\"!"
exit 1
fi
swupstat="$(gpio read $swupgpio)"
if [ "$swupstat" -eq 1 ]; then
exit 1
fi
folder="$(jq -r ".RandomVideo | .folder" < $configfile)"
playerparam="$(jq -r ".playerparam" < $configfile)"
pgrepplayer="$(jq -r ".pgrepplayer" < $configfile)"
swupgpio="$(jq -r ".swupgpio" < $configfile)"
playerfull="$(command -v $player) $playerparam"
if pgrep "$pgrepplayer" > /dev/null; then
if [ "$1" = "buzzer" ]; then
pkill "$pgrepplayer"