Running an executable fails whenever put in autostart.sh or autoexec.py

  • I am trying to run an executable that has output, but is disabled when passed a certain argument. Running the command in the terminal through ssh works perfectly, but putting it in autostart.sh, running a python script to run the executable in autoexec.py, or using an sh to start the python script doesn't work. Is there a way that I can get this file to work in autostart? The file that I am trying to do this with can be found here: http://www.unifiedremote.com/d/linux-x64-portable, and I used this command to run it ./urserver-3.6.0.745/urserver --daemon. I think the file is ran, but it is closed whenever the autostart is finished, but I am not sure why or how to prevent this from happening.

    • Official Post
    Code
    echo "(sleep 10 && /storage/urserver-3.6.0.745/urserver --daemon)&" > /storage/.config/autostart.sh

    ^ that should work as long as the /full/path/to/urserver is valid. It waits 10 seconds and then executes the command in the background. If you don't background the task the process will be correctly killed on script exit.

  • Code
    echo "(sleep 10 && /storage/urserver-3.6.0.745/urserver --daemon)&" > /storage/.config/autostart.sh

    ^ that should work as long as the /full/path/to/urserver is valid. It waits 10 seconds and then executes the command in the background. If you don't background the task the process will be correctly killed on script exit.

    It didn't automatically start, but whenever I ran "sh /storage/.config/autostart.sh" it worked perfectly, as if the program only worked if ran from a terminal. Is there any way I can get around this?

    • Official Post

    I'm guessing that autostart.sh doesn't know what $HOME is and thus cannot find your configuration file which would explain why it works in normal user mode but not in autostart.sh. Try adding --cpath pointing to your configuration file.

    Also adding export HOME=/storage in autostart.sh might also solve the problem.

  • How does even this binary runs because it needs libbluetooth.so.3? Did you copied it also?

    I copied this extra library to folder /storage/urserver-3.6.0.745 and use this line in autostart.sh. Daemon runs on a boot.

    Code
    (sleep 10 && LD_LIBRARY_PATH=/storage/urserver-3.6.0.745 /storage/urserver-3.6.0.745/urserver --daemon)&
  • Setting the library path is what fixed it. I had already downloaded libbluetooth and set it with export, so i guess that is why it only detected it when I was in the terminal session. Thank you!