jesseward / plex-lastfm-scrobbler

Scrobble played audio items Last.FM from the Plex Media Server application.
MIT License
92 stars 13 forks source link

Create process control scripts for Windows/Linux #17

Open jesseward opened 10 years ago

jesseward commented 10 years ago
jesseward commented 9 years ago

upstart script added in b070402c32c399524e871c8cd25b8844bbc5f595

jesseward commented 9 years ago

Leaving open if someone wants to commit OSX or Windows based scripts..

hale commented 9 years ago

Thanks for adding this!

I wonder though if on Linux we should use systemd instead of upstart. That way we could hook into the existing Plex service.

I'm on Fedora, maybe the Ubuntu version of Plex doesn't use systemd?

mkdir /usr/lib/systemd/system/plexmediaserver.service.d

cat <<EOF > /usr/lib/systemd/system/plexmediaserver.service.d/lastfm-scrobbler.conf
[Unit]
Wants=plex.lastfm.scrobbler
After=plex.lastfm.scrobbler
EOF

cat <<EOF > /usr/lib/systemd/system/plex.lastfm.scrobbler.service
[Unit]
Description=Plex Media Server Scrobbler for Last.FM
After=network.target

[Service]
Environment=PLEX_LASTFM_SCROBBLER_HOME=/usr/lib/plexmediaserver
ExecStart=/bin/python "${PLEX_LASTFM_SCROBBLER_HOME}/scripts/plex-scrobbler.py"
User=plex
Group=plex
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target
EOF

This is new to me, there will likely be mistakes - and I'm not sure how to handle sourcing the virtualenv - maybe the Environment should be read from plex_scrobble.conf to get a) the directory for the script and b) the directory for the virtualenv.

Let me know what you think :)

dannymichel commented 8 years ago

upstart script added in b070402 Does this mean you added a way to make this a service? If so, what are the steps to enabling this service or start-up script?

sbarrett-dev commented 8 years ago

@dannymichel if you are using a Windows based machine you might check out https://github.com/shiitake/Plax.FM which will run as a service.