summaryrefslogtreecommitdiff
path: root/openwrt/rhctl/files
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/rhctl/files')
-rwxr-xr-xopenwrt/rhctl/files/heartbeatclient.init24
-rw-r--r--openwrt/rhctl/files/rhctl.config1
2 files changed, 23 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"
diff --git a/openwrt/rhctl/files/rhctl.config b/openwrt/rhctl/files/rhctl.config
index ef8c617..2e4f176 100644
--- a/openwrt/rhctl/files/rhctl.config
+++ b/openwrt/rhctl/files/rhctl.config
@@ -31,3 +31,4 @@ config 'heartbeatclient'
option baudrate '38400'
option device '/dev/ttyHeartbeat'
option timeout '15'
+ option led 'heartbeat' \ No newline at end of file