mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-12-22 05:44:59 -05:00
switch: limit execution time to 90 seconds
We don't want to let it run forever because it blocks the toggle from working. But even if it's not, we wouldn't want to have the script run eternally.
This commit is contained in:
parent
ae40dcec1f
commit
db1c0c4c69
@ -1,15 +1,17 @@
|
||||
#!/bin/sh
|
||||
action=$1
|
||||
logger -p notice -t blue-merle-toggle "Called... ${action}"
|
||||
|
||||
|
||||
. /lib/functions/gl_util.sh
|
||||
|
||||
action=$1
|
||||
|
||||
logger -p notice -t blue-merle-toggle "Called... ${action}"
|
||||
|
||||
if [ "$action" = "on" ];then
|
||||
mcu_send_message "Blue Merle ${action}"
|
||||
echo "on" > /tmp/sim_change_switch
|
||||
flock -n /tmp/blue-merle-switch.lock /usr/bin/blue-merle-switch || logger -p notice -t blue-merle-toggle "Lockfile busy" &
|
||||
flock -n /tmp/blue-merle-switch.lock timeout 90 /usr/bin/blue-merle-switch || logger -p notice -t blue-merle-toggle "Lockfile busy" &
|
||||
logger -p notice -t blue-merle-toggle "Finished Switch"
|
||||
|
||||
elif [ "$action" = "off" ];then
|
||||
mcu_send_message "Blue Merle ${action}"
|
||||
|
Loading…
Reference in New Issue
Block a user