mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-10-01 04:55:39 +00:00
eab0633ad9
I hope that this allows us to use the toggle again to advance the Blue Merle logic. If all goes well, the script finishes execution and the switch lock in /var/lock/gl-switch.lock is released so that the button can be used again.
24 lines
602 B
Bash
24 lines
602 B
Bash
#!/bin/sh
|
|
action=$1
|
|
logger -p notice -t blue-merle-toggle "Called... ${action}"
|
|
|
|
|
|
. /lib/functions/gl_util.sh
|
|
|
|
|
|
|
|
if [ "$action" = "on" ];then
|
|
mcu_send_message "Blue Merle ${action}"
|
|
echo "on" > /tmp/sim_change_switch
|
|
ubus call file exec '{ "command": "flock", "params": ["-n", "/tmp/blue-merle-switch.lock", "timeout", "90", "/usr/bin/blue-merle-switch"] }'
|
|
|
|
elif [ "$action" = "off" ];then
|
|
mcu_send_message "Blue Merle ${action}"
|
|
echo "off" > /tmp/sim_change_switch
|
|
|
|
else
|
|
echo "off" > /tmp/sim_change_switch
|
|
fi
|
|
logger -p notice -t blue-merle-toggle "Finished Switch"
|
|
sleep 1
|