Search code examples
linuxunixrpmyumdnf

Application calling rpm to update itself problems


I am trying to allow a application to update itself by calling an RPM packet manager (right now DNF) to install an RPM containing an update. The problem is that when the packet manager uninstalls the application, the service is stopped and the packet manager is killed before it can install the new RPM.

Is there any way to detach the packet manager process so it can finish the update?


Solution

  • It's not clear how much control you have over how the update is run.

    One possible option is to put a check for updates, and the update itself, in a program that is run by a cron job. It's common for RPMs to install cron jobs, and the cron job won't be stopped if the service associated with the application is stopped.

    If the update must be started directly by the service, and you can control how the update is invoked, then you could use the at command to run it. See Run command 'at' 5 seconds from now for examples of using at. The update would be run by a separate service, so it wouldn't be stopped when your service is stopped. However, this requires at to be installed and the atd daemon to be running.