yast2-online-update-configuration email notifications

I have yet to install and configure it yet, but I was looking for documentation on configuring the online update configuration system to email me when updates are applied. Is there an easy way to do this? Any directions to docs that show this would be greatly appreciated.

thanks!

The documentation is here: https://doc.opensuse.org/documentation/leap/startup/html/book-opensuse-startup/cha-onlineupdate-you.html

But I do not see any reference to e-mails send.

I enabled packagekit-background.timer.

**erlangen:~ #** systemctl list-unit-files packagekit-background.timer 
UNIT FILE                   STATE   VENDOR PRESET
packagekit-background.timer **enabled ****disabled     **

1 unit files listed. 
**erlangen:~ #** systemctl list-timers  packagekit-background.timer 
NEXT                        LEFT     LAST                        PASSED UNIT                        ACTIVATES                    
Sun 2021-03-07 00:00:00 CET 10h left Sat 2021-03-06 06:14:50 CET 6h ago packagekit-background.timer packagekit-background.service 

**1 timers listed.**
Pass --all to see loaded but inactive timers, too. 
**erlangen:~ #**

I configured the timer to run packagekit-background.service daily and send a notification upon pending updates. It can also be configured to apply the updates.

Thanks. Is email option built into that package (apologies as I have not installed the os yet to check).

I just used YaST to set it up as per the documentation already mentioned above. It set up a link entry in /etc/cron.daily (for daily updates obviously!) to the update script file /usr/lib/YaST2/bin/online_update.

There is no email option that I am aware of but Cron does email me if there are errors when the script is run.

You could redirect the link to your own script that does the emailing and then calls the original one. Depends what you are looking for to be emailed out.

Just a remark. Not all people here love PackageKit as an alternative to zypper/YaST > software.
Also, YOU is not the same as “applying updates”, it only applies patches.

Ah interesting. But you could set another Cron job to update the packages with Zypper and email the output.

Of course there are many ways do automate getting patches/updates. The first question is probably if that is something to prefer (I don’t). But the original question was if YOU can be configured to send e-mails. And I do not think it can.

Yes:

**erlangen:~ #** cat /usr/share/PackageKit/packagekit-background.sh 
#!/bin/bash 
# Copyright (C) 2008 Richard Hughes <richard@hughsie.com> 
# 
# Some material taken from yum-cron, Copyright 2007 Alec Habig <ahabig@umn.edu> 
# 
# Licensed under the GNU General Public License Version 2 
# This program is free software; you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 2 of the License, or 
# (at your option) any later version. 

## Type:    yesno 
## Default: no 
# 
# Run the cron job. 
# 
ENABLED=no 

## Type:    yesno 
## Default: no 
# 
# Check if updates are available, instead of installing. 
# 
CHECK_ONLY=no 

## Type:    yesno 
## Default: no 
# 
# Trigger updates, so they will be installed on reboot. 
# 
UPDATE_OFFLINE=no 

## Type:    string 
## Default: "" 
# 
# If MAILTO is set, the mail command is used to deliver PackageKit output. 
# By default MAILTO is unset, so crond mails the output by itself. 
# 
MAILTO="" 

## Type:    string 
## Default: "" 
# 
# You may set SYSTEM_NAME if you want your PackageKit emails tagged differently. 
# Default is output of hostname command. 
# 
SYSTEM_NAME="" 

## Type:    integer 
## Default: 3600 
# 
# Update checks will sleep random time before contacting the servers to 
# avoid hammering them with thousands of request at the same time - this 
# is the maximum sleep time (in seconds) for the random wait period. 
# 
SLEEP_MAX=3600 

# are we disabled? 
if  "$ENABLED" = "no" ]; then 
        exit 0 
fi 

# set default for SYSTEM_NAME 
 -z "$SYSTEM_NAME" ] && SYSTEM_NAME=$(hostname) 

PKTMP=$(mktemp /var/run/packagekit-cron.XXXXXX) 
PKCON_OPTIONS="--background --noninteractive --plain" 
if  "$UPDATE_OFFLINE" = "yes" ]; then 
        ONLY_DOWNLOAD="--only-download" 
else 
        ONLY_DOWNLOAD="" 
fi 

# wait a random amount of time to avoid hammering the servers 
 -z "$SLEEP_MAX" ] && SLEEP_MAX=$RANDOM 
sleep $(( $RANDOM % $SLEEP_MAX + 1 )) 

# do action 
if  "$CHECK_ONLY" = "yes" ]; then 
        pkcon $PKCON_OPTIONS get-updates &> $PKTMP 
        PKCON_RETVAL=$? 
else 
        pkcon $PKCON_OPTIONS $ONLY_DOWNLOAD update &> $PKTMP 
        PKCON_RETVAL=$? 
        if  $PKCON_RETVAL -eq 0 -a "$UPDATE_OFFLINE" = "yes" ]; then 
                pkcon $PKCON_OPTIONS offline-trigger &> $PKTMP 
        fi 
fi 

# this is when seomthing useful was done 
if  $PKCON_RETVAL -ne 5 ]; then 
        # send email 
        if  -n "$MAILTO" ]; then 
                mail -Ssendwait -s "System updates available: $SYSTEM_NAME" $MAILTO < $PKTMP 
        else 
                # default behavior is to use cron's internal mailing of output from cron-script 
                cat $PKTMP 
        fi 
fi 

rm -f $PKTMP 

**erlangen:~ #**