Jump to content

Writing a startup script for emby-server


Recommended Posts

Posted

Hi,

 

As a bit of background, I've been dipping my toes in and out of linux for almost as long as linux has existed. I'm a mainfarme computer programmer so I understand programming and scripts. However, I've recently just decided to ditch windows altogether and go for it with a completely linux only installation. I've used Windows since v3.0 so obviously I'm used to being quite lazy. Having just installed Ubuntu I'm stepping back into the world of having to think again so apologies in advance if my question is so simple!

 

I've installed emby and it works just fine. However, being lazy (see above) I don't want to have to type sudo service emby-server start each time I want to start the server (apart from anything I keep forgetting the exact command) so I  have written an extremely simple script to do it for me...

#!/bin/bash

sudo service emby-server start

Although I  know it does work since I've run it and then checked via http://localhost what I'd really like if for emby to be a bit more verbose when I run the script so that when run from a term it will either direct it's output there or at least just say it's started OK.

 

Knowing linux as I do there are probably a million ways to achieve this, but the simplest option would be a switch somewhere somehow.

 

I'm sorry if this is a very long winded answer but I wasn't really sure what I'm asking apart from that I want to know after running the script that something has happened, without having to do anything more than read the screen.

 

Thanks for your help. I assure you that as I get more familiar with my new systen I will endevour to return the favour if anyone can help.

 

Cheers,

Ian.

 

Posted

yes outputting more to the console is a good idea

Posted

 Thanks for that gesture of solidarity, but I was hoping someone might be able to tell me how I can do it!

thefirstofthe300
Posted

I would use a bash alias along the lines of

emby="sudo service emby-server start && sleep 2 && sudo service emby-server status"

For more info on bash aliases.

http://tldp.org/LDP/abs/html/aliases.html

thefirstofthe300
Posted

Also, if you are using Ubuntu 15.04, I would recommend changing the init commands to systemd so it would be more along the lines of

emby="sudo systemctl start emby-server && sleep 2 && sudo systemctl status emby-server"

Also, don't forget that you can set emby to start at boot so you only need to start Emby if it crashes.  If it does crash, don't forget to report it here! :)

hurricanehrndz
Posted

Why not enable it on startup?

Posted

I never thought of using an alias, what a dashed jolly good idea! 

 

I ummed and ahhhed about enabling it at startup, but most of the time I don't need it running so it would just be hogging system resources.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...