Calling `service` vs `/etc/init.d/`

On OpenWrt 22.03.2 when I run /etc/init.d/simple-adblock check the check() function in my init script receives the as a parameter and works fine.

However if I run service simple-adblock check the check() function in my init script does not receive any parameters and fails.

Is there anything I can do to make it work with the service call?

Not really, aside from extending procd accordingly:

(only $1 and $2 are looked at)

1 Like

Using quotes to combine the remaining arguments into one single argument?

service simple-adblock "check"

Not sure if that would work, but you might try.

1 Like

It won't, as it then consider the string to be executed as a single binary (with spaces in the name). Changing procd's service command/ script would need changing - or the user has to realize that OpenWrt isn't RedHat…

1 Like

@slh, @hnyman, thank you gentlemen, I'll create a PR on github, hopefully someone will merge it to the main repo.

You are late...

1 Like