Page 4 of 4

Re: Linux Daemon scripts

PostPosted: Sun Mar 08, 2015 12:43 pm
by zip
thanks, why not update the wiki one?

Re: Linux Daemon scripts

PostPosted: Fri May 01, 2015 2:02 pm
by mellowcandle
I got mine working perfectly on Linux mint. should work on all Debian like machines.

I shared the code here.
https://nativeguru.wordpress.com/2015/05/01/linux-serviio-start-up-script/

Re: Linux Daemon scripts

PostPosted: Sat May 14, 2016 5:33 pm
by ryczypior
Yes, I know this is old topic, but for newest ubuntu 16.04 none of above works for me.

I've created a simple service script for systemd:

1. Create file /lib/systemd/system/serviio.service (as root - sudo):
  Code:
$ sudo touch /lib/systemd/system/serviio.service


2. Put these lines of code into created file:
  Code:
[Unit]
Description=Serviio daemon

[Service]
Type=simple
Environment=statedir=/opt/serviio #path to serviio environment
ExecStart=/opt/serviio/bin/serviio.sh #path to serviio.sh on your FS

[Install]
WantedBy=multi-user.targetroot


3. Enable service for autostart:
  Code:
sudo systemctl enable serviio.service


From now, you should be able to do for start serviio service:
  Code:
sudo service serviio start

and for for stop serviio service:
  Code:
sudo service serviio stop


Also status and restart should work.

If your OS uses systemd, it should works for you :)

Re: Linux Daemon scripts

PostPosted: Fri Jul 22, 2016 5:23 pm
by worric
ryczypior wrote:Yes, I know this is old topic, but for newest ubuntu 16.04 none of above works for me.

I've created a simple service script for systemd:

1. Create file /lib/systemd/system/serviio.service (as root - sudo):
  Code:
$ sudo touch /lib/systemd/system/serviio.service


2. Put these lines of code into created file:
  Code:
[Unit]
Description=Serviio daemon

[Service]
Type=simple
Environment=statedir=/opt/serviio #path to serviio environment
ExecStart=/opt/serviio/bin/serviio.sh #path to serviio.sh on your FS

[Install]
WantedBy=multi-user.targetroot


3. Enable service for autostart:
  Code:
sudo systemctl enable serviio.service


From now, you should be able to do for start serviio service:
  Code:
sudo service serviio start

and for for stop serviio service:
  Code:
sudo service serviio stop


Also status and restart should work.

If your OS uses systemd, it should works for you :)


I just created this account to comment on this post. First of all, that you very much for providing this code, it really helped me understand how services are managed in systemd-based distributions. However, I can say that for the "enable"-command to work properly on my new Ubuntu Server 16.04.1 install, I had to remove the "root" at the very end of the last line in the serviio.service file. I found out by navigating to /etc/systemd/system and discovering that there was no multi-user.targetroot.wants directory. There was a directory named multi-user.target.wants, however, and after removing "root" in the service file, the sudo systemctl enable serviio.service worked flawlessly, and serviio does indeed start correctly at boot.

So just to clarify, the following code works on my system:
  Code:
[Unit]
Description=Serviio daemon

[Service]
Type=simple
Environment=statedir=/opt/serviio #path to serviio environment
ExecStart=/opt/serviio/bin/serviio.sh #path to serviio.sh on your FS

[Install]
WantedBy=multi-user.target

Re: Linux Daemon scripts

PostPosted: Sat Jun 16, 2018 2:22 pm
by tibiscum
Ubuntu 18.04 LTS Server

Many thanks for zip (*special*), jtl, jopiexjoker [Page 1 code] and so many others.

I've put the code listed by jopiexjoker on my new Ubuntu 18.04 LTS Server (with JRE 1.8.0_171) and works very fine.
I've registred serviio as service by folowing cmd:

$ sudo /lib/systemd/systemd-sysv-install enable serviio

Thaks a lot all of you!

Re: Linux Daemon scripts

PostPosted: Sun Jan 16, 2022 1:52 am
by code78
The best way to implement serviio as service (daemon) on Debian Bullseye, over systemd is very easy:

Go to the terminal and do the following steps:

go to the folder: /etc/systemd/system
and create a file with a name like "serviio.service", and paste de following code inside:
  Code:
# Contents of /etc/systemd/system/serviio.service
[Unit]
Description=Serviio Media Server
After=network.target

[Service]
Type=simple
Restart=always
ExecStart=/etc/serviio-2.2.1/bin/serviio.sh   # change to your serviio.sh path

[Install]
WantedBy=multi-user.target


Update the daemon list:
  Code:
systemctl daemon-reload


If you like this daemon autostart:
  Code:
systemctl enable serviio.service


To run the daemon right now:
  Code:
systemctl start serviio.service


That's all folks! :geek:

Re: Linux Daemon scripts

PostPosted: Sat Jan 28, 2023 4:00 pm
by chester
If the service fails to start with something similar to this:
[root@serviio~]# journalctl -xe
serviio.service - Serviio Media Server
Loaded: loaded (/etc/systemd/system/serviio.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-01-28 14:39:45 UTC; 9s ago
Process: 3472 ExecStart=/opt/serviio/bin/serviio.sh (code=exited, status=203/EXEC)
Main PID: 3472 (code=exited, status=203/EXEC)

Jan 28 14:39:45 tfm-rius systemd[1]: Starting serviio daemon...
Jan 28 14:39:45 tfm-rius systemd[3472]: serviio.service: Failed to execute command: Exec format error
Jan 28 14:39:45 tfm-rius systemd[3472]: serviio.service: Failed at step EXEC spawning /opt/serviio/bin/serviio: Exec format error
Jan 28 14:39:45 tfm-rius systemd[1]: serviio.service: Main process exited, code=exited, status=203/EXEC
Jan 28 14:39:45 tfm-rius systemd[1]: serviio.service: Failed with result 'exit-code'.
Jan 28 14:39:45 tfm-rius systemd[1]: Failed to start serviio daemon.


Then you might have selinux set to enforcing. If the following is true:
[root@serviio~]# getenforce
Enforcing

Then you need to give the serviio.sh script additional permissions as follows:
[root@serviio~]# semanage fcontext -a -t bin_t /opt/serviio/bin/serviio.sh
[root@serviio~]# restorecon -vF /opt/serviio/bin/serviio.sh

Good luck!

Re: Linux Daemon scripts

PostPosted: Thu Aug 10, 2023 5:29 pm
by carpler
Pay no attention to my previous post.
I realised that the problem was not Selinux, but that I was missing Java!!!
It would be good if on the page of the site where the prerequisites for installation on Linux are indicated, in addition to ffmpeg, Java is also indicated.
My mistake anyway.
A more comprehensive guide for linux users wouldn't be bad though.