summaryrefslogtreecommitdiff
path: root/openwrt/rhctl/files/heartbeatclient.init
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/rhctl/files/heartbeatclient.init')
-rwxr-xr-xopenwrt/rhctl/files/heartbeatclient.init24
1 files changed, 22 insertions, 2 deletions
diff --git a/openwrt/rhctl/files/heartbeatclient.init b/openwrt/rhctl/files/heartbeatclient.init
index b201c5e..b4c6042 100755
--- a/openwrt/rhctl/files/heartbeatclient.init
+++ b/openwrt/rhctl/files/heartbeatclient.init
@@ -22,21 +22,41 @@ start_daemon() {
local value
local args=""
+ local status="OK"
for option in $CONFIG_OPTIONS
do
config_get value "$1" "$option"
option=`echo $option | tr '_' '-'`
- if [ -n "$value" ]; then
+ if [ $option = "led" ]; then
+ local led_path
+ eval "led_path=\${LED_${value}}"
+ if [ -z "$led_path" ]; then
+ status="OK but led not found"
+ else
+ led_path="/sys/class/leds/$led_path/brightness"
+ args="$args --led $led_path"
+ fi
+ elif [ -n "$value" ]; then
args="$args --$option $value"
fi
done
- local status="OK"
$DAEMON --write-pid $PIDFILE $args || status="failed"
echo -n " ($status)"
}
+get_led()
+{
+ local name
+ local sysfs
+ config_get name $1 name
+ config_get sysfs $1 sysfs
+ eval LED_$name=$sysfs
+}
+
start() {
echo -n "Starting $DESC:"
+ config_load "system"
+ config_foreach get_led "led"
config_load "rhctl"
mkdir -p $RUN_D
config_foreach start_daemon "heartbeatclient"