Automatic update

  • Hello!

    I'm looking for a setting to update Openmediavault automatically, so I don't always have to check if a new version is available.


    Is there such a possibility and where ?


    Many thanks in advance.


    Sincerely R.Lehmeier

    • Official Post

    You need to provide a solution on your own. OMV only installs security updates automatically, but everything else is not installed by intention because an update might cause a failure. This decision to install those updates must be on the user side.

  • First thought is a shell script would be needed for this but would be interested to learn more!


    I say shell script because automatic updates to linux systems aren't as simple as just "pressing an [update] button" because it might not be something that can or should happen, depending on your setup. No [one]'s system is like [another]'s, thus no [one] update will perform as [another]. Therefore it would be something that should NOT be easily performed by a newb like myself, but also possibly not sanctioned by the amazing devs who contribute to the OS (choose your flavor), they're all amazing in my book!


    Now I'll say that there is one thing I'm truly certain of.


    Sometimes it's not even a good idea for me to run anything on my machine under my own supervision:D! Let alone allowing something that alters my system files to run at will.

    • Official Post

    Here's how I do it... It might look complicated but it's pretty simple.


    SSH your server and become root and cd to your root directory


    Code
    cd /

    Make a directory called "scripts" and then cd into said directory

    Code
    mkdir scripts
    Code
    cd /scripts

    Open a blank file called omv-upgrade.sh in nano

    Code
    nano omv-upgrade.sh

    You'll get a blank screen, copy/paste the below into it

    Code
    #! /bin/bash
    omv-upgrade

    Save it with Cntrl + X, then Y, then Enter. And you'll be back at the prompt


    Now make the file executable


    Code
    chmod +x omv-upgrade.sh

    Now, test the script (when you run the command below, you should see your system update)

    Code
    sh omv-upgrade.sh

    Once you've confirmed it works, it's just a matter of scheduling it.

    Go to the OMV webui under Systems/Scheduled tasks, click the + sign to create a new task.


    Now, you may want to Google how to use cron scheduling, otherwise you may accidentally have this job running every 10sec and not even know it... but here's an example of a job that runs every Saturday morning at 0300.


    Once you set your times, etc.


    Set your user to "root"


    Then set your command as sh and the path to your script ie, sh /scripts/omv-upgrade.sh


    Save the job and apply the changes


    Once back at the list of scheduled tasks, click the job and click the "play" button at the top to give it a test run. Note when you manually run it you'll have to click "Start" to run the job, and you'll see in the window it updating your system. When it's scheduled, it will just run.


    That's it. Only thing I've not perfected is applying any changes to the webuI after an update. I've tried a couple different methods and they didn't work properly. So usualy later Saturday or Sunday morning, I log in to the webuI and apply any changes that need to be made.


    It sounds complicated, but honestly it's ridiculously simple.

  • Below is how I do it, do not know the benefit of creating a .sh script and run that?

    The only anyoing thing I have yet to solve is the ribbon that pops up when accessing omv webgui telling me to apply configuration or whatever it says.

    • Official Post

    Below is how I do it, do not know the benefit of creating a .sh script and run that?

    The only anyoing thing I have yet to solve is the ribbon that pops up when accessing omv webgui telling me to apply configuration or whatever it says.

    Lol. You know you're right. When I done this a long time ago, I was scripting several things and that was one of them on the list. Didn't even dawn on me to just run it directly.


    Now I feel like a fool.. 😃

  • I use this command in the scheduled task to also apply pending changes automatically:


    omv-upgrade && omv-rpc -u admin "config" "applyChanges" "{ \"modules\": $(cat /var/lib/openmediavault/dirtymodules.json),\"force\": true }" 2>/dev/null


    found the second command here:
    Apply "Pending configuration changes" on the command line

    Applying changes when there are none, thats why I ignore errors, not ideal but does the job.

    Works well in OMV 7.

  • Aren't the modules automatically updated during an omv-upgrade?


    I have run omv-upgrade && omv-rpc -u admin “config” “applyChanges” “{ \”modules\“: $(cat /var/lib/openmediavault/dirtymodules.json),\”force\“: true }” 2>/dev/null as a test and only get a 'Connection lost' and the output:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!