Run cron task after update

Is there a way to run a cron task after updating UC?
That cron task would contain a command which downloads a certain package.
Did anybody ever do this? Could you help me out?

Take this as an example:

  1. An update gets installed on UC
  2. Cron task is launched
    2.1 The cron task contains “sudo apt-get install unrar” command, which downloads the unrar package.

This happens automatically, and there’s no user control needed.

Hello @lars.ziegelmann

what do you refer to with “UC”? Do you mean UCS?

Best regards,
Nico

Hello @gulden

Yes, I mean UCS. Sorry.

Hello @lars.ziegelmann

OK, UCS. I don’t understand yet, why a cron job should run after an update is run on UCS, to for example install additional software. Can you please take me with you and let me know the desired outcome? Thank you.

Best regards,
Nico

Hello @gulden

Okay. So if I understand correctly, after installing an update on UCS all additional software gets deleted/reset. That’s why we would like to run a cron task, to automatically install the additional software, that got deleted/reset with the update.

That is the reason why I brought up “unrar” as an example.
Is my thinking correct? Did I misunderstand something?

Hello @lars.ziegelmann

Where does this assumption come from?

Do you have and example? What do you mean with “additional software”?

An update on UCS basically runs a apt update && apt upgrade, see the documentation. If installed packages can be updated the system will update them. For app updates you need to use the App Center. Those updates are separate.

I hope this helps for understanding.

Best regards,
Nico

Yes, after updating an app in the App Center.

Let’s say, I want to extract a .rar file, because I need it for an app from App Center. If I want to extract that file, I need the “unrar” package. That means I have to run sudo apt-get install unrar to actually get the package.
But after updating UCS and the app in the App Center, I would need to run the command again to get the package, correct? So all I’m asking if there’s an option to run a task designed to run that command by itself after an update?

Usually, unless no broken dependencies are found, packages don’t get reset by updates. As @gulden asked I also don’t know where you take that assumption that things get magically deleted / reset with updates.

If you ‘apt install unrar’ once, it should stay on the system unless its dependencies or unrar itself gets removed by either yourself or rarely a broken update. Also things like custom scripts manually extracted to the filesystem are only likely to being overwritten by an update - but only if you have placed them in locations of standard libraries. (This is why paths like /usr/local and /opt exist)

@msi the way I read it @lars.ziegelmann is not talking about packages being installed on the ucs system itself, but packages being installed in the container of an app.

So something like:

  • have app installed
  • want to extend it and therefore add additional software to the container
  • update app to newer version
    -> all additional software and modifications in the container are gone

IMHO: if it should be possible for users to extend a running container, then the container would need to take care, that these modifications are done in places where recreation of the container would persist these (so in mounted volumes for example, or prevent people from manually adding anything and make everything achievable through environment variables, …).

EDIT: the other obvious answer would be to not run the existing container, but completely replace it with one you have built yourself. but this would not be compatible with the univention appcenter.