FAQ  •  Register  •  Login

Linux Daemon scripts

<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Mar 08, 2015 12:43 pm

Re: Linux Daemon scripts

thanks, why not update the wiki one?
<<

mellowcandle

Serviio newbie

Posts: 2

Joined: Fri May 01, 2015 1:55 pm

Post Fri May 01, 2015 2:02 pm

Re: Linux Daemon scripts

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/
<<

ryczypior

Serviio newbie

Posts: 1

Joined: Sat May 14, 2016 5:21 pm

Post Sat May 14, 2016 5:33 pm

Re: Linux Daemon scripts

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 :)
<<

worric

Serviio newbie

Posts: 1

Joined: Fri Jul 22, 2016 5:01 pm

Post Fri Jul 22, 2016 5:23 pm

Re: Linux Daemon scripts

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
<<

tibiscum

Serviio newbie

Posts: 2

Joined: Fri Apr 20, 2012 2:44 pm

Post Sat Jun 16, 2018 2:22 pm

Re: Linux Daemon scripts

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!
<<

code78

Serviio newbie

Posts: 1

Joined: Sun Jan 16, 2022 1:34 am

Post Sun Jan 16, 2022 1:52 am

Re: Linux Daemon scripts

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:
<<

chester

Serviio newbie

Posts: 1

Joined: Sat Jan 28, 2023 3:45 pm

Post Sat Jan 28, 2023 4:00 pm

Re: Linux Daemon scripts

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!
<<

carpler

Serviio newbie

Posts: 9

Joined: Fri Aug 25, 2017 8:14 am

Post Thu Aug 10, 2023 5:29 pm

Re: Linux Daemon scripts

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.
Last edited by carpler on Fri Aug 11, 2023 7:47 am, edited 1 time in total.
Previous

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 11 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.