Page 1 of 1

[SOLVED] Systemd/systemctl service file for serviio

PostPosted: Sat Jan 14, 2012 8:39 pm
by shashchatter
Hi,

If this helps somebody else, here's a simple file that allows serviio start/stop on systemd-compatible systems.

I am using Fedora 16. My serviio distribution is installed under "/opt/serviio/serviio-0.6.16". I have create a user "serviio" and a group "serviio", and all the files under /opt/serviio are owned by this user and group.

To use this:
- put the content below in "/lib/systemd/system/serviio.service"
#-- Start of serviio.service file --
# Systemd unit file for serviio
#

[Unit]
Description=Serviio DLNA/uPNP server
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/sbin/runuser -l serviio -c "/opt/serviio/serviio-0.6.1/bin/serviio.sh &"
ExecStop=/sbin/runuser -l serviio -c "/opt/serviio/serviio-0.6.1/bin/serviio.sh -stop &"

[Install]
WantedBy=multi-user.target
#-- End of serviio.service file --
- enable the serviio service: "systemctl enable serviio.service". it will automatically start after reboots.
- To manually stop the service: "systemctl stop serviio.service"
- To manually start the service: "systemctl start serviio.service"
- To check status: "systemctl status serviio.service"


Hope this helps!
Shash

Re: [SOLVED] Systemd/systemctl service file for serviio

PostPosted: Sun Jan 15, 2012 7:43 am
by Cerberus
serviio -start and serviio -stop ;)

Re: [SOLVED] Systemd/systemctl service file for serviio

PostPosted: Sun Nov 11, 2012 2:10 am
by SamSpade
Here's the complete installation process and alternative serviio.service file for Arch Linux 3.6.6 onwards (with systemd). This applies to CLI-only or headless Arch Linux installations. Using the Serviio Console GUI will require more packages, of course.

Download Serviio 1.0.1 and instal in /usr/local (or other preferred directory):
  Code:
curl -O http://download.serviio.org/releases/serviio-1.0.1-linux.tar.gz
tar -C /usr/local -xvzf serviio-1.0.1-linux.tar.gz


Create 'serviio' username as a service account:
  Code:
useradd -r -U -d /usr/local/serviio-1.0.1  serviio


Let serviio own all files in its directories:
  Code:
chown -R serviio:serviio /usr/local/serviio-1.0.1


Install java and ffmpeg:
  Code:
pacman -S jre7-openjdk-headless ffmpeg
# The thumbnail routines also need the libraries in the following packages if they're not installed yet:
pacman -S fontconfig libcups


Create systemd service in /etc/systemd/service (not in multi-user.target.wants):
  Code:
#  /etc/systemd/system/serviio.service
[Unit]
Description=Serviio 1.0.1 Media Server
After=network.target

[Service]
User=serviio
ExecStart=/usr/local/serviio-1.0.1/bin/serviio.sh
ExecStop=/usr/local/serviio-1.0.1/bin/serviio.sh -stop
KillMode=none

[Install]
WantedBy=multi-user.target

This is what makes systemd so elegant, despite its birth pains ... no need for 'su -', tracking PID files and other complex startup scripts!

Enable the service for boot:
  Code:
systemctl enable serviio.service


As usual for systemd, to manually start and stop:
  Code:
systemctl start serviio.service
systemctl stop serviio.service
systemctl status serviio.service

Re: [SOLVED] Systemd/systemctl service file for serviio

PostPosted: Sun Nov 11, 2012 11:38 pm
by zip
Would be great if you could replicate it on the Wiki :-)

Re: [SOLVED] Systemd/systemctl service file can not see vide

PostPosted: Tue Apr 15, 2014 11:34 pm
by sirkit
Thanks for the posts I managed to install serviio 1.4.1.2 on ARCH LINUX (CLI only) but I can not see my videos when I view my TV I install serviio to # /usr/local/serviio-1.4.1.2/

and my video file are located in /data500/
I did run a symlink by typing ln -s /data500/

then restarted serviio by typing systemctl restart serviio.service

but when I looked ar the tv still could not see any gilms in the video folder please could someone point me in the right direction, I am new to arch and have only used serviio on windows PC

Re: [SOLVED] Systemd/systemctl service file for serviio

PostPosted: Thu Oct 22, 2015 11:15 pm
by Ben Burke
Thanks you guys - I upgraded my Ubu recently and had to learn some systemd stuff. Great explanation.

Now to setup the web console, because I loose firing off X-sessions with nested logins 8-)


Ben

Re: [SOLVED] Systemd/systemctl service file for serviio

PostPosted: Sun Aug 19, 2018 6:14 am
by ttguy
So there are two solutions in this thread. I just want to vote for the second one by SamSpade. That is what worked for me. This was on my Kubuntu 16.04 install. Just rebooted that machine after following the directions and Serviio was running without intervention. (I have my machine to log in with out a password - I dunno if that is relevant. But SamSpade has made me a happy camper.)