FAQ  •  Register  •  Login

How to switch Serviio status by program/script?

<<

RYann

Serviio newbie

Posts: 10

Joined: Mon Jan 14, 2013 6:32 pm

Post Sun May 21, 2017 5:15 pm

How to switch Serviio status by program/script?

Hello,

On my system (macOS laptot) I observe that Serviio always restarts after a system reboot, even if I used the Serviio-console to switch Serviio status to "Stopped" before.

Then, I would like to write a script to switch back Serviio status to "Stopped" (and not "Running") during my system bootup, because I may use and reboot my laptop sometimes in other places that home and I don't want it to be running and responding outside my local netwrok.

On the FAQ i found this topic (http://serviio.org/component/content/article?id=21#q13)

  Code:
    * start the server
    sudo launchctl load -F /Library/LaunchDaemons/org.serviio.server.plist
    * stop the server
    sudo launchctl unload /Library/LaunchDaemons/org.serviio.server.plist

Nevertheless, this is not really helpful for me because it does not do the same as a user switch in Serviio-Console between "Running" and "Stopped" for Serviio Status
1) those 2 system commands require admin password while user in Serviio-Console not.
2) if you "stop" the server with this command, it's not the same than stopping it with the Serviio-Console. After launchctl unload, Serviio-Console is not longer able to work, and the user cannot use it any longer to switch Serviio Statut back to running.

So Iim really looking for a way to perform exactly the same action as a manual user-click on "Stop" in the Serviio-console.
Maybe is there a way through web inferface? Or other way through the API?
best regards.
<<

ami289

Streaming enthusiast

Posts: 46

Joined: Sat Aug 15, 2015 8:36 am

Post Sun May 21, 2017 6:51 pm

Re: How to switch Serviio status by program/script?

Hi mate,

Not sure this is exactly what you are looking for, but this is how I would have go about it.

It has been a while since I've used my mac, so I'm a bit rusty.....
Also, since I'm not using Serviio on a mac, perhaps there is a built-in way of doing the below.
I'm just not familiar with the mac version of Serviio.
But this should get the job done nonetheless.

Anyway, what I would have done is-
1)
Edit org.serviio.server.plist
If it run at startup, it should probably have something along the following lines in it-
  Code:
<key>RunAtLoad</key>
   <true/>

Change it to
  Code:
<key>RunAtLoad</key>
   <false/>

This would stop Serviio from auto-starting upon boot.

2)
Create a bash script with the line that starts Serviio,
So you can manually start the service whenever you want-
  Code:
    sudo launchctl load -F /Library/LaunchDaemons/org.serviio.server.plist

If you don't like to enter the password each time you run this script, you can just construct it this way-
  Code:
    echo YOUR_ROOT_PASSWORD | sudo -S launchctl load -F /Library/LaunchDaemons/org.serviio.server.plist

Please note that in the example below, the root password is transparent to anyone who have access to this file...


Good luck mate.
<<

atc98092

User avatar

DLNA master

Posts: 5205

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Sun May 21, 2017 8:10 pm

Re: How to switch Serviio status by program/script?

Also an FYI: the server control in the console does not control the actual Serviio service. It only turns the DLNA server portion on and off. I'm sure Zip has a reason for it, but I really don't know what it could be used for. The service itself runs at all times unless you manually change it. Unsure on a Mac, but on Windows you can set it at manual instead of auto start, but it has to be done in the Services applet. What ami289 lists sounds like it will do the same thing.

Also, when Serviio is installed on Windows, it creates links to start and stop the service from the Start Menu. I would guess that something similar is on a Mac. That way you can have the service set to manual (as ami289 described) and then start it when you want it running. Then messing with scripts with root passwords visible aren't necessary. :D
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 21 guests

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