subscribe to our Youtube


14455 questions

17168 answers


0 members

We are migrating to our new platform at Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
133 views 0 comments
by anonymous


I try to run a custom script at startup of the RUTX09. The code runs when I enter it in the CLI, but it seems not to work in the custom script:

iostate1="$(ubus call ioman.gpio.din1 status | grep "value" | cut -c 12)"

 if [ "$iostate1" == "1" ]; then

  ubus call profile change '{"name":"OffLine2"}';


What I need is to switch to another profile when the input is changed. It does change when set the profile change in the I/O Juggler, but that is only when a change in input is detected. But when the input is high at startup, the profile does not change to the desired profile.

This code does return either a 1 of 0, depending of the status of the input: ubus call ioman.gpio.din1 status | grep "value" | cut -c 12

And the startup script does run when I ignore the input state, but when I use this:

 if [ "1" == "1" ]; then

  ubus call profile change '{"name":"OffLine2"}';


It seems that the router doesn't see the input state at startup. Anyone any idea? Thanks!

1 Answer

0 votes
by anonymous


Perhaps you could try adding these lines:

/etc/init.d/ioman restart

/etc/init.d/iojuggler restart

Before obtaining the pin status and check if that helps.

Most likely some background service has not had time to come up by the time you are trying to read the state.

If that does not help, please add this line after the IF statement:

logger "$iostate1"

We would need to figure out whether the issue is that ubus is returning a wrong value, or perhaps it is returning an error.

Best regards,