Results 1 to 8 of 8

Thread: Best way to automate "zypper dup" via cron

  1. #1
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    717

    Default Best way to automate "zypper dup" via cron

    I was wondering what's the best way to automate the "zypper dup" command using cron for openSUSE Tumbleweed. I already have kcron installed and can easily set up a task as root: My curiosity is what parameters I should use for the zypper command to avoid any prompts, so updates can be automatically installed at the given hour without someone having to type "y" after seeing the package list or "yes" for a license prompt.

    My only uncertainty is what the process will do in case of temporary dependency issues. If possible I'd like to make it pick the solution "break Whatever by ignoring some of its dependencies", as this has never caused any actual issues and usually gets resolved within a few hours. If not I'm fine with the automated update process being skipped when it detects conflicts.
    openSUSE Tumbleweed x64, KDE Framework 5

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,916
    Blog Entries
    2

    Default Re: Best way to automate "zypper dup" via cron

    Info is in the zypper MAN pages, but is also in my zypper Wiki on most common commands used in scripted installs
    https://en.opensuse.org/User:Tsu2/BASH_zypper

    And, an example of an unattended (automated, no User interaction) install... Which probably does a lot more than you want or need (like detecting TW vs LEAP and auto configuring the repo URL)
    https://github.com/putztzu/lc0/blob/...penSUSE_lc0.sh

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    717

    Default Re: Best way to automate "zypper dup" via cron

    Thank you. It seems to be as simple as using "zypper -n dup". Does this skip license prompts as well? What does it do in the case of detecting package issues?
    openSUSE Tumbleweed x64, KDE Framework 5

  4. #4
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    885

    Default Re: Best way to automate "zypper dup" via cron

    Quote Originally Posted by MirceaKitsune View Post
    I was wondering what's the best way to automate the "zypper dup" command using cron for openSUSE ...
    An even better way is using systemd. You may use units packagekit-background.timer and packagekit-background.service as a template for zypper timer and service units in folder /etc/systemd/system.
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), openSUSE Tumbleweed, KDE Plasma 5

  5. #5
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,916
    Blog Entries
    2

    Default Re: Best way to automate "zypper dup" via cron

    Quote Originally Posted by MirceaKitsune View Post
    Thank you. It seems to be as simple as using "zypper -n dup". Does this skip license prompts as well? What does it do in the case of detecting package issues?
    There is another required option you have to specify to auto agree licenses, and whenever there is a package conflict, the default will be option 1.
    It's in the zypper MAN pages and the example I provided the link.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  6. #6
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    717

    Default Re: Best way to automate "zypper dup" via cron

    "zypper -n dup -l" should be it then. Is this correct? Thanks!
    openSUSE Tumbleweed x64, KDE Framework 5

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,916
    Blog Entries
    2

    Default Re: Best way to automate "zypper dup" via cron

    From my example

    Line 13
    Code:
    # Update system, always a good idea before a major install
    zypper dup -y
    and if you need to install packages unattended

    Line 54
    (note these are options I prefer to allow when recommended by the openSUSE maintainers)
    Code:
    zypper in -y --allow-vendor-change --allow-downgrade 
    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  8. #8
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,486
    Blog Entries
    15

    Default Re: Best way to automate "zypper dup" via cron

    Hi
    I would suggest a read of the /etc/zypper.conf and /etc/zypper/zypp.conf, especially with the latter as it might be advisable to set the download all packages option before proceeding, then if something goes pear shaped, at least the packages will be present on the system.... you can also disable some of the options your adding on the command line.

    The zypper-log command will also be your friend...

    Code:
    zypper-log -d 2019-08-11
    Reading /var/log/zypper.log ............... DONE
    
    TIME              PID    VER      CMD
    2019-08-11 09:18  14756  1.14.28  zypper ref
    2019-08-11 09:19  15408  1.14.28  zypper -vvv dup
    2019-08-11 09:21  29329  1.14.29  zypper ps -s
    
    zypper-log 15408
    
    2019-08-11 09:19:07 <1> grover(15408) [zypper] main.cc(main):74 ===== Hi, me zypper 1.14.28
    .....
    .....
    2019-08-11 09:21:11 <1> grover(15408) [zypp++] MediaHandler.cc(removeAttachPoint):181 MediaHandler - checking if to remove attach point
    My zypper -vv dup took just under two minutes....
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •