not working under systemd on linux

37 views
Skip to first unread message

artur9

unread,
Mar 25, 2018, 11:41:48 AM3/25/18
to Sonospy Development
Sonospy is working great, transcoding and everything.  Search seems a little off but I'm ok with that for now.

I tried to make a systemd service file for it but that does not work.  After doing a 
systemctl start sonospy.service
python ends up eating 99% of the CPU and not becoming visible in the Sonos controller.

If I log in as the sonospy user I created, and set up everything the same as systemd, it works.  I created the sonospy user via
useradd -r sonospy -d /usr/local/share/sonospy
and I unzipped the  msrefactor5 zip in there.

Any ideas?  Here's the sonospy.service I created.  I linked it to the systemctl directory like this:
ln ~sonospy/sonospy.service /etc/systemd/system/

systemctl enable sonospy.service


more ~sonospy/sonospy.service

[Unit]

Description=Library Manager for Sonos

After=syslog.target

After=network.target


[Service]

Type=simple

User=sonospy

Group=sonospy

WorkingDirectory=/usr/local/share/sonospy/sonospy-msrefactor5/sonospy

Nice=-1

StandardInput=null

StandardOutput=journal

StandardError=journal

# Note: if start fails check with "systemctl status sonospy" or journalctl -u sonospy

Environment=LD_LIBRARY_PATH=/usr/local/lib

Environment=SONOS_ZP=<ZP_ADDRESS>

ExecStart=/usr/bin/python pycpoint.py -p -sSonospy=CD,$HOME/standard-sonos.db -sSonospy=Hi,$HOME/hi-sonos.db -r -d -z $SONOS_ZP

Restart=always

RestartSec=1min

TimeoutSec=15


[Install]

WantedBy=multi-user.target


artur9

unread,
Mar 25, 2018, 6:46:31 PM3/25/18
to Sonospy Development
I found the problem.  ExecStart does not expand the $HOME variables.  Who knew?

So 

ExecStart=/usr/bin/python pycpoint.py -p -sSonospy=CD,$HOME/standard-sonos.db -sSonospy=Hi,$HOME/hi-sonos.db -r -d -z $SONOS_ZP

needs to be

ExecStart=/usr/bin/python pycpoint.py -p -sSonospy=CD,/user/sonospy/standard-sonos.db -sSonospy=Hi,/user/sonospy/hi-sonos.db -r -d -z $SONOS_ZP

or whatever HOME really is.

artur9

unread,
Mar 26, 2018, 10:54:29 AM3/26/18
to Sonospy Development
Actually, it will expand them but the syntax is ${} for variables so the working version is:

ExecStart=/usr/bin/python pycpoint.py -p -sSonospy=CD,${HOME}/standard-sonos.db -sSonospy=Hi,${HOME}/hi-sonos.db -r -d -z ${SONOS_ZP}



Mark Henkelis

unread,
Mar 26, 2018, 5:36:19 PM3/26/18
to sonosp...@googlegroups.com

I love it when someone answers their own question :o)

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.
To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

Mark Henkelis

unread,
Mar 26, 2018, 5:41:32 PM3/26/18
to sonosp...@googlegroups.com

You don't need both -r and -z in your command line. -r registers with the first ZP it finds, whereas -z forces it to use the one you specify (and overrides -r).

Mark.


On 26/03/18 15:54, artur9 wrote:
Actually, it will expand them but the syntax is ${} for variables so the working version is:

ExecStart=/usr/bin/python pycpoint.py -p -sSonospy=CD,${HOME}/standard-sonos.db -sSonospy=Hi,${HOME}/hi-sonos.db -r -d -z ${SONOS_ZP}



Reply all
Reply to author
Forward
0 new messages