[SOLVED]Start something at boot

  • Hi there!

    I'm trying to launch spotify-connect at boot. I'm posting here because it's not a problem with the addon. I want to launch this :

    Code
    /storage/.kodi/addons/service.spotify-connect-web/spotify-connect-web --username MYUSER --password MYPW --bitrate 320 --name MYSERVER -o default:CARD=ALSA

    From the command line, this is working perfectly. So I tried various method (I'm not a beginner with linux systems)


    1. The autostart.sh method

    I first tried with /storage/.configautostart.sh (I made it runnable with "chmod +x" :(

    Bash
    #!/bin/bash
    (
     /storage/.kodi/addons/service.spotify-connect-web/spotify-connect-web --username MYUSER --password MYPW --bitrate 320 --name MYSERVER -o default:CARD=ALSA
    ) &

    Not working; it's not the command, because even a simple

    Code
    echo "test" > /storage/.kodi/test.txt

    is not working either. Seems libreelec don't care about autostart.sh.

    2. The systemctl service

    /storage/.config/system.d/spotify-connect.service


      
    Not working at boot. I tried to use an alternate script in the "ExecStart" line :

    Code
    ExecStart=/storage/.config/spotify-script.sh

    And the spotify-script.sh (runnable) :

    Bash
    #!/bin/bash
    cd /storage/.kodi/addons/service.spotify-connect-web
    /storage/.kodi/addons/service.spotify-connect-web/spotify-connect-web --username MYUSER --password MYPW --bitrate 320 --name MYSERVER -o default:CARD=ALSA

    This is working when running "systemctl start spotify-connect", so I tried to enable it at boot with

    Code
    systemctl enable spotify-connect

    but at boot... nothing happens.

    3. Crontab

    Code
    crontab -e

    then

    Code
    @reboot /storage/.kodi/addons/service.spotify-connect-web/spotify-connect-web --username MYUSER --password MYPW --bitrate 320 --name MYSERVER -o default:CARD=ALSA

    nothing happens.


    Aaaand... I have no more ideas. Can someone point me to one of my errors, or have another idea?

    TL;DR : I want to start a command at boot but nothin works.


    Thank you!


    Libreelec 7.0.2.

    Edited once, last by tehzaz (December 2, 2016 at 2:29 PM).

  • service.spotify-connect-web is already a service by default and should start automatically.

    What you get with command

    Code
    systemctl status service.spotify-connect-web

    Edited once, last by vpeter (December 2, 2016 at 2:00 PM).

  • Thanks for your answer.
    You're right about this addon supposed to start automatically; but for some reason, it didn't wanted to read it's settings.xml file, and failed to start.

    I got it working just few minutes ago, by running the script (spotify-script.sh in my first post) from autostart.sh.

    Bash
    #!/bin/bash
    (
            /storage/.config/spotify-script.sh
    ) &

    Well, if it's work with the script instead of the whole command... Why not.

  • What are you trying to do? Set a custom display name? If possible, change LE's hostname.

    If not, you can edit /storage/.kodi/addons/service.spotify-connect-web/bin/spotify-connect-web.start and reboot or restart the service with
    systemctl restart service.spotify-connect-web

    If you tell me what you are trying to do, and it is reasonable, i might fit it into the addon


  • Script you posted has error

    Haha you're right, it was a copy/paste misclick ;) I fixed the 1st message.



    What are you trying to do? Set a custom display name? If possible, change LE's hostname.

    If not, you can edit /storage/.kodi/addons/service.spotify-connect-web/bin/spotify-connect-web.start and reboot or restart the service with
    systemctl restart service.spotify-connect-web

    If you tell me what you are trying to do, and it is reasonable, i might fit it into the addon't trying to change the displayname, just

    I was just trying to start the service at boot, since the default (built-in) method was not working. It seems that the plugin was not reading the "settings.xml ", but I didn't found why. It was telling he couldn't find the "spotify_appkey.key", despite the file was at the right place(s).

    I think I'll remove the plugin and my scripts, and make the whole process again to find out if it's working as supposed.


    EDIT @awiouy : I just realized you're the author of this addon. You're doing a great work.

    Edited once, last by tehzaz (December 2, 2016 at 3:06 PM).