run a 'zypper refresh' at boot

I’d like to have zypper do a refresh when I boot, after network comes up of course. What’s a good way to do this? I was thinking a systemd service file. But maybe theres an easier way?

Two points:

(1) there’s no good reason to do this. When you next try to do any update, it will refresh as needed.

(2) On some boots, “zypper purge-kernels” is run. That and your proposed “zypper refresh” will interfere with one another (whichever comes first will block the other).

Hmm: a third point. If you are using KDE, just allow the software updater to run when you login. That will refresh the repos. When the tray icon either goes away or reports that there are updates, you will know that the refresh has finished.

Well I think I have at least one good reason. I am always searching repos using zypper. Everyday. That first refresh takes a good 30 seconds.

I’ll try setting my KDE update app to ‘Daily’. Thanks for the idea.

You don’t need to write your own:

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

2 unit files listed. 
**3400G:~ #**

Enable packagekit-background.timer.