Search code examples
unixcron

Are there any downsides to making a crontab update for an operating system?


If I have an application hosted on my server, I would like to automatized as most as possible. If it's not recommended, are there any other solutions except from doing it manually?


Solution

  • Sure, why not? I'm assuming you mean (for Debian/Ubuntu) something like 0 3 * * * sudo apt update && sudo apt upgrade -y.

    For Debian-based distros (like Ubuntu and Pop!_OS) the colloquial advice is to use the unattended-upgrades package, but I believe this is only because it standardizes the way unattended/automatic upgrades are done on Debian based systems. For example, logs go in a certain spot, and I believe you can set it up to send an email if there's an issue/when an upgrade is completed.

    Of course in either case there is risk that this breaks something while you are unable to get to the server to fix it. For example, upgrading MySQL Server on an Ubuntu server I had once, broke MySQL Server, as in refused to restart, so I had a service running on a cron schedule that was failing, but I had no idea since I had no idea MySQL Server wasn't running - and that wasn't even a headless upgrade. Upgrades can break things, is the TLDR.