Return code of /etc/init.d/led reload

Hi, can someone confirm that /etc/init.d/led reload or restart exits always with return code 1 instead of 0?

I use a script aborting on any failure and this command causes it to abort because it always exits with code 1. Is there something wrong on my device or does this always happen? Reloading of other services works flawlessly.

package/base-files/files/etc/init.d/led

defines load_led() and start(), so stop, reload, and restart would be "default" implementations.

package/base-files/files/etc/rc.common

stop() {
        return 0
}

reload() {
        restart
}

restart() {
        trap '' TERM
        stop "$@"
        trap - TERM
        start "$@"
}

So I don't see anything there to suggest that anything but 0 or the return value of start()

I suspect that considering "led" as a service, rather than a boot-time initialization, may be at the root of the behavior you're seeing.

Changing the led script to use -vx may provide more insight as to why you're seeing a non-zero return value.

Thanks for your reply.

Should I consider it differently? I need to know what command causes changes to the LED config in /etc/config/system to be applied. I thought /etc/init.d/led reload is the correct way?!

Unfortunately I don't know where to pass the -vx switch. Executing /etc/init.d/led reload -vx does not provide any insight.

At least as I read package/base-files/files/etc/init.d/led, it looks like is it intended as a one-shot initialization, rather than as a persistent service. If you look at it, it appears to take the UCI values from the config files and applies them.

You could likely add "logging" by modifying the "shebang" (possible by editing on your running device) to something like:

#!/bin/sh -vx /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=96

load_led() {
[...]

The times I have tried to debug some "internal" scripts, the output has appeared in the logs.

Do you have a better idea of what to call after making changes to /etc/config/system? I'm wondering what the correct way to do it is.

Getting the logging unfortunately didn't work. After the modification:

# /etc/init.d/led reload
/bin/sh: illegal option -