[SOLVED]Systemd Autostart doesnt work properly?

hey guys,
im just installed spotify-web-connect to raspberry pi.

with the change of some paths and files i can get it to work, but my systemd autostart isnt working.
after several tries the actual service ist starting, but i think there are some problems with my arguments…
in putty i use
/home/osmc/spotify-connect-web.sh --name Pi --username myusername --password mypassword --bitrate 320
or
./spotify-connect-web.sh --name Pi --username myusername --password mypassword --bitrate 320
and it will work immediately.

Also it will work if i’ll start my service manually in shell with sudo systemctl start spotify.service

This is my spotify.service file
`
[Unit]
Description=Spotify
After=mediacenter.target

[Service]
Type=simple
User=osmc
Group=osmc
ExecStart=/home/osmc/spotify-connect-web.sh sh --name Pi --username myusername --password mypassword --bitrate 320

[Install]
WantedBy=multi-user.target
`

Is there a problem with the arguments?
Spotifyconnectweb is starting but it says im not logged in…

Sorry, but i’m very new to OSMC, i already love it to play around but this tricky thing just dont work for me :smiley:

There is no mediacenter.target - what are you trying to do here ?

Are you sure that should say web.sh sh, with sh twice ?

Did you enable the service ? A newly created service (creating the .service file) will not be enabled.

Does the service need to wait until the network is up before starting ? If so enable “wait for network” in the network GUI, and add:

After=network-online.target

In the [Unit] section. This will delay starting the service until the network is really up.

I copied mediacenter.target from other services…
just thought this would be good, i tried several thing, also network-online.target
the ExecStart is obviously bad copied by notepad++, i just checked it and its just one .sh
of course my service is enabled.

Its working, but when i connect to spotifyconnect via port4000 it says im not logged in.
also systemctl status says its running
if i start the shellscript by putty, i’ll work…

My spotify.service :
[Unit]
Description=Spotify
After=network-online.target

[Service]
User=osmc
Group=osmc
ExecStart=/home/osmc/spotify-connect-web.sh --name Pi --username xx --password xx --bitrate 320

[Install]
WantedBy=multi-user.target

FINALLY i got it working!
I dont know why, but it need type=idle, then it works.
my final spotify.service:
[Unit]
Description=Spotify
After=network-online.target

[Service]
Type=idle
User=osmc
ExecStart=/home/osmc/spotify-connect-web.sh --name Pi --username xxx–password xxx --bitrate 320

[Install]
WantedBy=multi-user.target

Thanks for your help

1 Like