Giter Club home page Giter Club logo

update_ombi's Introduction

update_ombi

Ombi update script for Systemd (Ubuntu based distros)

Create the Ombi update script

wget https://raw.githubusercontent.com/Unimatrix0/update_ombi/master/update_ombi.sh

Note:

This script assumes your systemd service is named ombi. If this is not the case, set the ombiservicename variable at the top of the script.
The script attempts to automatically detect the required variables by parsing the service file.
It assumes the service file is named ombiservicename.service in the default directory (/etc/systemd/system/).
If the service file can't be found, or if the variables can't be parsed from the service file, it assumes they are the defaults of

The script also logs to /var/log/ombiupdater.log by default. Make sure that the user running the script has write access to this file.
You can override these defaults by setting the variables in the Default variables section at the top.

Edit the script file to set variables as needed.

nano update_ombi.sh

Press Ctrl+X then y to save (assuming you're using nano).

Make it executable

chmod +x ~/update_ombi.sh 

When an update is available for Ombi simply run

sudo ./update_ombi.sh

If you do not plan to run the script as a user with full sudo privileges, you can restrict access for the user with the following:
Edit the sudoers file to give restricted access to the script user

sudo visudo

Near the bottom of the file, add:

ombi    ALL=NOPASSWD: /bin/systemctl stop ombi.service, /bin/systemctl start ombi.service

Note:

This assumes you're running the script as ombi and that the systemd service is named ombi.

Configuration File Support with Variables

In order to ensure that this script applies updates correctly for your environment, you may need to create a configuration file. This script looks for update_ombi.conf in the same directory as update_ombi.sh.

Variable Comment Default Value
ombiservicename The systemd unit for Ombi ombi
logfile The update_ombi log file /var/log/ombiupdater.log
ombiservicefile The service file's full path /etc/systemd/system/$ombiservicename.service
defaultinstalldir Ombi install directory /opt/Ombi
defaultuser The user Ombi runs as ombi
defaultgroup The group Ombi runs as nogroup
defaultip The IP Ombi runs on 127.0.0.1
defaultport The port Ombi runs on 5000
verbosity Level of verbosity (-1 to 8), see Log Levels below -1

Log Levels

By default, verbosity is set to -1, which means it will not output anything. Using switch -v=# or --verbosity #. Options 1 through 7 will log to STDOUT. Option 8 logs to STDOUT and the logfile. The default log location is /var/log/ombiupdater.log.

Log Level Status
-1 None
0 Emergency
1 Alert
2 Critical
3 Error
4 Warning
5 Notice
6 Info
7 Debug
8 Trace

update_ombi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

update_ombi's Issues

Assumptions with default location

It would be nice to be able to keep updated with latest master for all future enhancements to update_ombi; but doing so overwrites changes to update_ombi.sh, which include modifying values like the default location of Ombi.

In update_ombi.sh, have default values. Perhaps in the same directory as update_ombi.sh, it could look for update_ombi.conf, source update_ombi.conf, and pull values from there to overwrite any default values.
Add update_ombi.conf to .gitignore

What do you think?

Problem "determining expected file size"

First Checks:

☑ I am running the most recent version of the script.
☑ I have followed the setup instructions correctly.
☑ I have set the appropriate file permissions and modes.
☑ I am running the script as the correct user. (root)

Update Script Version

1.2.00

Ombi Version:

3.0.3011

Operating System:

Debian 8

Update Script Applicable Logs: (/var/log/ombiupdater.log by default)

[2018-03-15 18:07:58 UTC] [info] No config file found...using defaults...
[2018-03-15 18:07:58 UTC] [info] update_ombi v1.2.00
[2018-03-15 18:07:58 UTC] [info] Verbosity level: [debug]
[2018-03-15 18:07:58 UTC] [debug] Update script running as: root
[2018-03-15 18:07:58 UTC] [info] Ombi service file for systemd found...parsing...
[2018-03-15 18:07:58 UTC] [info] Parsing complete: InstallDir: /opt/Ombi/, User: root, Group: root
[2018-03-15 18:07:58 UTC] [notice] IP not parsed or set as "*"...setting to default: [hidden]
[2018-03-15 18:07:58 UTC] [notice] Port not parsed...setting to default: 5000
[2018-03-15 18:07:58 UTC] [info] Downloading Ombi update...
[2018-03-15 18:07:58 UTC] [info] Checking for latest version
[2018-03-15 18:07:58 UTC] [debug] latestversion: 3.0.3038
[2018-03-15 18:07:59 UTC] [debug] jobId: de5widyumxr6sxoo
[2018-03-15 18:07:59 UTC] [debug] version: 3.0.3038
[2018-03-15 18:07:59 UTC] [info] Latest version: 3.0.3038...determining expected file size...
[2018-03-15 18:07:59 UTC] [debug] size:
[2018-03-15 18:07:59 UTC] [err] Unable to determine update file size...[attempt 1 of 5]
[2018-03-15 18:07:59 UTC] [info] Checking for latest version
[2018-03-15 18:07:59 UTC] [debug] latestversion: 3.0.3038
[2018-03-15 18:08:03 UTC] [debug] jobId: de5widyumxr6sxoo
[2018-03-15 18:08:03 UTC] [debug] version: 3.0.3038
[2018-03-15 18:08:03 UTC] [info] Latest version: 3.0.3038...determining expected file size...
[2018-03-15 18:08:04 UTC] [debug] size:
[2018-03-15 18:08:04 UTC] [err] Unable to determine update file size...[attempt 2 of 5]
[2018-03-15 18:08:04 UTC] [info] Checking for latest version
[2018-03-15 18:08:04 UTC] [debug] latestversion: 3.0.3038
[2018-03-15 18:08:04 UTC] [debug] jobId: de5widyumxr6sxoo
[2018-03-15 18:08:04 UTC] [debug] version: 3.0.3038
[2018-03-15 18:08:04 UTC] [info] Latest version: 3.0.3038...determining expected file size...
[2018-03-15 18:08:05 UTC] [debug] size:
[2018-03-15 18:08:05 UTC] [err] Unable to determine update file size...[attempt 3 of 5]
[2018-03-15 18:08:05 UTC] [info] Checking for latest version
[2018-03-15 18:08:05 UTC] [debug] latestversion: 3.0.3038
[2018-03-15 18:08:06 UTC] [debug] jobId: de5widyumxr6sxoo
[2018-03-15 18:08:06 UTC] [debug] version: 3.0.3038
[2018-03-15 18:08:06 UTC] [info] Latest version: 3.0.3038...determining expected file size...
[2018-03-15 18:08:06 UTC] [debug] size:
[2018-03-15 18:08:06 UTC] [err] Unable to determine update file size...[attempt 4 of 5]
[2018-03-15 18:08:06 UTC] [info] Checking for latest version
[2018-03-15 18:08:06 UTC] [debug] latestversion: 3.0.3038
[2018-03-15 18:08:07 UTC] [debug] jobId: de5widyumxr6sxoo
[2018-03-15 18:08:07 UTC] [debug] version: 3.0.3038
[2018-03-15 18:08:07 UTC] [info] Latest version: 3.0.3038...determining expected file size...
[2018-03-15 18:08:08 UTC] [debug] size:
[2018-03-15 18:08:08 UTC] [crit] Unable to determine update file size...[attempt 5 of 5]...Bailing!

Problem Description:

Hello,

Since the last version of ombi, the update is not done anymore.

I updated the update_ombi.sh script but when I run it I do not update anymore.
I execute it as root and everything is well configured.

The script blocks checking the size of the archive to download.

Allow updating to only stable releases (or other branches if needed)

First Checks:

x I am running the most recent version of the script.
x I have followed the setup instructions correctly.
x I have set the appropriate file permissions and modes.
x I am running the script as the correct user.

Update Script Version

1.1.02

Ombi Version:

3.0.3022

Operating System:

Ubuntu Server 17.10 (Linux 4.13.0-36-generic x64)

Custom Configuration: (update_ombi.conf)

N/A

Update Script Applicable Logs: (/var/log/ombiupdater.log by default)

N/A

Problem Description:

As of posting the script is broken, but assuming it is resolved by #20 this will only allow updating to beta versions of Ombi and only builds that come from the develop branch. It would be nice if we could have the script handle updates only to stable releases, or for that matter to other branches. In the case of #20 as you can see by the commit history the DotNetCore branch was renamed to develop after the initial PR was made, which furthers my opinion that the need for handling multiple branches should be considered.

Initial Troubleshooting:

N/A

Reproduction Steps:

N/A

Additional Detail:

N/A

Add arm architecture support

Not a problem, just thinking we could very easily run some command to determine if the system is arm architecture and download the appropriate zip.

I'll try to make a PR this week for the code unless someone beats me to it.

Update fails when trying to stop Ombi

First Checks:

Replace the check box for each line with a ☑ or 'x' after confirming.
x I am running the most recent version of the script.
x I have followed the setup instructions correctly.
x I have set the appropriate file permissions and modes.
x I am running the script as the correct user.

Update Script Version

1.1.02

Ombi Version:

3.0.2973

Operating System:

Linux 4.9.0-0.bpo.5-amd64 #1 SMP Debian 4.9.65-3+deb9u2~bpo8+1 (2017-01-05) x86_64 GNU/Linux

Custom Configuration: (update_ombi.conf)

defaultuser="ombi"
defaultgroup="ombi"
defaultport="5001"
verbosity=7
defaultinstalldir=/opt/ombi

Update Script Applicable Logs: (/var/log/ombiupdater.log by default)

[2018-03-09 01:54:05 UTC] [info] Script config file found...parsing...
[2018-03-09 01:54:05 UTC] [info] Parsed config file
[2018-03-09 01:54:05 UTC] [info] update_ombi v1.1.02
[2018-03-09 01:54:05 UTC] [info] Verbosity level: [debug]
[2018-03-09 01:54:05 UTC] [debug] Update script running as: root
[2018-03-09 01:54:05 UTC] [notice] InstallDir not parsed...setting to default: /opt/ombi
[2018-03-09 01:54:05 UTC] [notice] User not parsed...setting to default: ombi
[2018-03-09 01:54:05 UTC] [notice] Group not parsed...setting to default: ombi
[2018-03-09 01:54:05 UTC] [notice] IP not parsed or set as "*"...setting to default: 127.0.0.1
[2018-03-09 01:54:05 UTC] [notice] Port not parsed...setting to default: 5001
[2018-03-09 01:54:05 UTC] [info] Downloading Ombi update...
[2018-03-09 01:54:05 UTC] [info] Checking for latest version
[2018-03-09 01:54:13 UTC] [debug] latestversion: 3.0.2989
[2018-03-09 01:54:14 UTC] [debug] jobId: 6kb4x4eep3t59mth
[2018-03-09 01:54:14 UTC] [debug] version: 3.0.2989
[2018-03-09 01:54:14 UTC] [info] Latest version: 3.0.2989...determining expected file size...
[2018-03-09 01:54:14 UTC] [debug] size: 47317277
[2018-03-09 01:54:14 UTC] [info] Expected file size: 47317277...downloading...
[2018-03-09 01:54:25 UTC] [info] Version 3.0.2989 downloaded...checking file size...
[2018-03-09 01:54:25 UTC] [info] File size validated...checking Ombi service status...
[2018-03-09 01:54:25 UTC] [info] Ombi is active...attempting to stop...
[2018-03-09 01:54:25 UTC] [alert] Unknown error...bailing!
[2018-03-09 01:59:34 UTC] [info] Script config file found...parsing...
[2018-03-09 01:59:34 UTC] [info] Parsed config file
[2018-03-09 01:59:34 UTC] [info] update_ombi v1.1.02
[2018-03-09 01:59:34 UTC] [info] Verbosity level: [debug]
[2018-03-09 01:59:34 UTC] [debug] Update script running as: root
[2018-03-09 01:59:34 UTC] [notice] InstallDir not parsed...setting to default: /opt/ombi
[2018-03-09 01:59:34 UTC] [notice] User not parsed...setting to default: ombi
[2018-03-09 01:59:34 UTC] [notice] Group not parsed...setting to default: ombi
[2018-03-09 01:59:34 UTC] [notice] IP not parsed or set as "*"...setting to default: 127.0.0.1
[2018-03-09 01:59:34 UTC] [notice] Port not parsed...setting to default: 5001
[2018-03-09 01:59:34 UTC] [info] Downloading Ombi update...
[2018-03-09 01:59:34 UTC] [info] Checking for latest version
[2018-03-09 01:59:35 UTC] [debug] latestversion: 3.0.2989
[2018-03-09 01:59:35 UTC] [debug] jobId: 6kb4x4eep3t59mth
[2018-03-09 01:59:35 UTC] [debug] version: 3.0.2989
[2018-03-09 01:59:35 UTC] [info] Latest version: 3.0.2989...determining expected file size...
[2018-03-09 01:59:36 UTC] [debug] size: 47317277
[2018-03-09 01:59:36 UTC] [info] Expected file size: 47317277...downloading...
[2018-03-09 01:59:48 UTC] [info] Version 3.0.2989 downloaded...checking file size...
[2018-03-09 01:59:48 UTC] [info] File size validated...checking Ombi service status...
[2018-03-09 01:59:48 UTC] [info] Ombi is not active...installing update...
[2018-03-09 01:59:50 UTC] [info] Update installed...setting ownership...
[2018-03-09 01:59:50 UTC] [info] Ownership set...not starting Ombi
[2018-03-09 01:59:50 UTC] [info] Cleaning up...
[2018-03-09 01:59:50 UTC] [info] Update complete...elapsed time 16 seconds...

Problem Description:

When running update_ombi, it goes to shut down Ombi via systemd then says an unknown error and bailing.

Initial Troubleshooting:

Not sure why systemd returning unknown here.

++ date '+%Y-%m-%d %H:%M:%S %Z' -u
+ echo '[2018-03-09 02:04:36 UTC] [info]' 'File size validated...checking Ombi service status...'
+ declare -i running=0
++ systemctl is-active ombi
+ '[' active == active ']'
+ running=1
+ .log 6 'Ombi is active...attempting to stop...'
+ local LEVEL=6
+ shift
+ [[ 7 =~ ^-?[0-8]$ ]]
+ '[' 7 -ge 6 ']'
++ date +%H:%M:%S
+ echo '[18:04:36] [info]' 'Ombi is active...attempting to stop...'
[18:04:36] [info] Ombi is active...attempting to stop...
+ '[' 7 -eq 8 ']'
+ '[' 6 -ne 8 ']'
++ date '+%Y-%m-%d %H:%M:%S %Z' -u
+ echo '[2018-03-09 02:04:36 UTC] [info]' 'Ombi is active...attempting to stop...'
+ declare -i i=1
+ declare -i j=5
+ '[' 1 -le 5 ']'
+ '[' root = root ']'
+ systemctl stop ombi.service
+ '[' 0 -ne 0 ']'
++ systemctl is-active ombi
+ '[' unknown == active ']'
++ systemctl is-active ombi
+ '[' unknown == inactive ']'
+ .log 1 'Unknown error...bailing!'
+ local LEVEL=1
+ shift
+ [[ 7 =~ ^-?[0-8]$ ]]
+ '[' 7 -ge 1 ']'
++ date +%H:%M:%S
+ echo '[18:04:36] [alert]' 'Unknown error...bailing!'
[18:04:36] [alert] Unknown error...bailing!
+ '[' 7 -eq 8 ']'
+ '[' 1 -ne 8 ']'
++ date '+%Y-%m-%d %H:%M:%S %Z' -u
+ echo '[2018-03-09 02:04:36 UTC] [alert]' 'Unknown error...bailing!'
+ exit 99

Reproduction Steps:

Simply run update_ombi with Ombi started.

Additional Detail:

systemd version 215-17+deb8u7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.