Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add leds scripts fir server and proxy #561

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions omr-tracker/files/usr/share/omr/proxy-post-tracking.d/030-leds
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

[ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ] && exit 0

set_leds() {
local cfg=$1
config_get trigger $cfg trigger
[ "$trigger" != "proxy" ] && return
config_get sysfs $cfg sysfs
config_get proxy_status $cfg proxy_status
if [ "$proxy_status" = "off" ]; then
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
echo 'default-on' > /sys/class/leds/${sysfs}/trigger
else
echo 'none' > /sys/class/leds/${sysfs}/trigger
fi
elif [ "$proxy_status" = "on" ]; then
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
echo 'none' > /sys/class/leds/${sysfs}/trigger
else
echo 'default-on' > /sys/class/leds/${sysfs}/trigger
fi
fi
}

config_load system
config_foreach set_leds led
27 changes: 27 additions & 0 deletions omr-tracker/files/usr/share/omr/server-post-tracking.d/030-leds
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

[ "$OMR_TRACKER_PREV_STATUS" = "$OMR_TRACKER_STATUS" ] && exit 0

set_leds() {
local cfg=$1
config_get trigger $cfg trigger
[ "$trigger" != "server" ] && return
config_get sysfs $cfg sysfs
config_get server_status $cfg server_status
if [ "$server_status" = "off" ]; then
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
echo 'default-on' > /sys/class/leds/${sysfs}/trigger
else
echo 'none' > /sys/class/leds/${sysfs}/trigger
fi
elif [ "$server_status" = "on" ]; then
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
echo 'none' > /sys/class/leds/${sysfs}/trigger
else
echo 'default-on' > /sys/class/leds/${sysfs}/trigger
fi
fi
}

config_load system
config_foreach set_leds led