Jump to content

Customizable Emby auto-updater for Linux


Gecko

Recommended Posts

Hello the Emby Community  👋

I recently created a script to auto-update Emby-Server (on Ubuntu) today and wanted to share it with you. I know there are other versions on the forum, but none were customizable the way I wanted it to be.

Here are the possibilities with this version :

  • is able to look for stable only or any latest releases
  • is able to fetch a specific release
  • can ask for a user confirmation before installing anything (in case you run it manually)

The script will never downgrade a version without asking you first, so there is no risk breaking Emby by downgrading from beta to stable.
By default, only stable releases are installed AFTER asking your permission.

Here's the help text :

Auto-update Emby-Server to the very last version found on github
----------------------------------------------------------------

The user can either choose the stable or beta branch
A user confirmation can be requested before installing a new version

When no options are given :
  -> only Stable releases are looked for
  -> a user confirmation is mandatory

Options:
--stable           Only look for the latest Stable release
--latest           Only look for the latest (Beta or Stable) release
--version          Specify a version to install as a 2nd argument
                   If no argument is provided, display a list of all available versions on Github
-s, --silent       Do not ask for a user input when a new version is found
-h, --help         Print this help

 

You can run it manually or to schedule it, you can copy the emby_updater.sh to any directory and then use the below script from the same directory.
This will :

  • copy the updater into the default directory of Emby (/opt/emby-server)
  • activate the updater 5 minutes after every reboot (OnBootSec=5min)
  • activate the updater every night at 6AM (OnCalendar=*-*-* 06:00:00)
  • activate the update at any other time if the last start date was missed (Persistent=true)
  • allow any new version, beta or stable (--latest flag) to be automatically installed (--silent flag)
     
mkdir -p /opt/emby-server/updater
cp emby_updater.sh /opt/emby-server/updater/
chmod +x /opt/emby-server/updater/emby_updater.sh

echo "[Unit]
Description=Auto-update Emby-Server on a schedule

[Service]
Type=oneshot
ExecStart=/bin/bash /opt/emby-server/updater/emby_updater.sh --latest --silent
" > /etc/systemd/system/emby_updater.service

echo "[Unit]
Description=Auto-update Emby-Server on a schedule

[Timer]
OnBootSec=5min
OnCalendar=*-*-* 06:00:00
Persistent=true

[Install]
WantedBy=timers.target
" > /etc/systemd/system/emby_updater.timer

systemctl daemon-reload
systemctl enable emby_updater.timer
systemctl start emby_updater.timer

 

Enjoy !

 

emby_updater.sh

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
bluesite

Hi,

nice script thx

if emby server is running i have so restart it after the update

for automatic update i have enter the following lines after line 44

    # stopping emby before updating
    echo -e "    -> Stopping Emby-Server $emby_candidate_version ..."
    systemctl stop emby-server

 

Link to comment
Share on other sites

11 hours ago, bluesite said:

Hi,

nice script thx

if emby server is running i have so restart it after the update

for automatic update i have enter the following lines after line 44

    # stopping emby before updating
    echo -e "    -> Stopping Emby-Server $emby_candidate_version ..."
    systemctl stop emby-server

 

Yeah the official updater should take care of the start&stop of the running Emby-server process but in case it doesn't, what you added is exactly what was missing in the script.
You shouldn't have to restart it manually after the update thought as systemctl start emby-server is already in the script on line #63.

Link to comment
Share on other sites

bluesite

if i run your script for the update i got the message on emby at the settings that i have to restart the service
the service did not restart automaticly here

Link to comment
Share on other sites

On 10/3/2023 at 11:17 AM, Gecko said:

I know there are other versions on the forum, but none were customizable the way I wanted it to be.

May I suggest you add something like this:

ARC=$(dpkg –print-architecture)

Then change the lines like:

grep_filter=".*https://github.com/MediaBrowser/Emby.Releases/releases/download/${version}/emby-server-deb_${version}_amd64.deb\"$"

To:

grep_filter=".*https://github.com/MediaBrowser/Emby.Releases/releases/download/${version}/emby-server-deb_${version}_${ARC}.deb\"$"

This should make it work for all (or at least most?) Debian based OS’s (Debian, Ubuntu, Mint, Mate... Pi(&Pi like...)...) that emby can run on.😃

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
raidflex

This script does not work for me on a LXC container using Ubuntu 22.04. I receive the below error.

 

root@Emby:/opt/emby-server/updater# ./emby_updater.sh --latest --silent
./emby_updater.sh: line 135: syntax error near unexpected token `then'
./emby_updater.sh: line 135: `    if [[ $emby_installed_version == $emby_candidate_version ]] then'
root@Emby:/opt/emby-server/updater# 

 

Edited by raidflex
Link to comment
Share on other sites

Gecko
Posted (edited)
On 1/6/2024 at 7:27 PM, raidflex said:

Nvm fixed the issue, just missing the ";" at the end of line 135.

Gosh didn't saw that one, thank you for the correction !

I cannot update my initial post so here's the script with the updates and ideas from @bluesite@raidflexand @TMCsw. Thanks you all!

emby_updater.sh

Edited by Gecko
  • Like 1
Link to comment
Share on other sites

raidflex
14 minutes ago, Gecko said:

Gosh didn't saw that one, thank you for the correction !

I cannot update my initial post so here's the script with the updates and ideas from @bluesite@raidflexand @TMCsw. Thanks you all!

emby_updater.sh 8.97 kB · 0 downloads

 

Thanks for the script it's working great! Just recently setup a Proxmox server and trying to get as much automated as possible.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
Oratorian

I am testing a selfhosted repository that I created for emby.

I took @Geckoscript, and modified it for my needs, It just checks for updated binaries, downloads them and puts them into the repo.
At the moment it only supports the i386/amd64 releases of emby.
I will add the others by due time.

I created two releases, one for stable and one for beta.

echo 'deb https://repo.amhosting.de/ubuntu beta main' > /etc/apt/sources.list.d/emby.list

or 

echo 'deb https://repo.amhosting.de/ubuntu stable main' > /etc/apt/sources.list.d/emby.list

The Repository is signed with the following Key : 3B6E90FE3203A81F

Import it

curl -fsSl https://repo.amhosting.de/repo-key.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/repo.amhosting.gpg

After that you should be able to install emby with
 

sudo apt install emby-server

 This Repo also works for all Debian based systems.

  • Thanks 2
Link to comment
Share on other sites

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