How to get Notified when Ubuntu Server Updates are Available
About automated update management
Regularly updating server packages is crucial. It enhances security, ensures stability, and keeps your server compatible with the latest software. Neglecting updates can lead to security risks, downtime, and compatibility issues. Stay proactive for a more secure and reliable server.
Automating the update process for server packages is essential for a few key reasons. Firstly, human administrators can sometimes forget or overlook these updates, leaving the system vulnerable. Secondly, it eliminates the need for manual, repetitive tasks that can be both time-consuming and tedious. By automating, you ensure that updates are consistently applied without reliance on human memory or effort, enhancing both security and efficiency.
Step by step guide for automated notifications
Pipetower makes it very easy to get automated notifications when Ubuntu server updates are available. It's the first step to a fully automated update management process.
Step 1: Create an action to check for updates
The first step is to create an Action in Pipetower. The Action describes what you want to execute on your server(s). The Action for our use case consists of two action steps. In the first action step we will just update the Ubuntu sources and repositories. In the second action step we will list all packages that can be updated. We will use this output later to check if we want to receive a notification or not.
After creating this Pipetower Action, you can just run it manually to see how the output will look like. Press the "play" button in the top right of your Action view and select the server on which you want to execute this Action.
Now these two action steps are executed on your selected server and you will see the output in realtime directly in Pipetower.
As you can see in the log of the ’apt list --upgradable’ command, that it will output all packages that can be updated. Notice the highlighted words "upgradable from". We will make use of this pattern for our notification setup in the following step.
Step 2: Setup a schedule with notification
Now it's time to setup our schedule. The idea is to let Pipetower run our previously created Action once a week. When the output of the executed Action contains the words "upgradable from", then we know that updates are available and Pipetower should notify us by email.
These kind of "When -> Then" logic can be done in Pipetower with "Pipes". Pipes are a powerful feature to react on specific events and to trigger some action. The event in our case will be a time schedule (once a week). The first triggered step is to execute our "apt check". The second triggered step is to send a notification. Each triggered step can be combined with conditions when to perform the step and when not. Our condition for the second step is to check for the existence of the words "upgradable from" in the first triggered step.
First, create in Pipetower a new Pipe with the Trigger type Schedule and Trigger event Every week. Additionally you have to define on which day of the week and at which time of the day the Pipe should be triggered.
With this in place, every monday at 10 am UTC this Pipe will be triggered. What this Pipe will do comes now.
Next, click on the plus icon to create the 1. Step of this Pipe. In the 1. Step we will define that our previously created Action Check apt updates will be executed on the selected server.
Next, click again the plus icon to add the 2. Step of this Pipe. In the 2. Step we will define that after our Action was executed, Pipetower should send us an email notification.
The last thing we have to do is to instruct Pipetower to only send the notification when we find the words "[upgradable from:" in the output of our Action.
To do so, click the Add condition link. Now you can define that the notification should only be sent when the output of our 2. Pipe step contains the words "[upgradable from:".
Finally, save your Pipe. That's it. From now on, Pipetower will email you on every monday at 10 am when Ubuntu updates are available!
Conclusion
To keep your server up-to-date with the latest package updates is an important and a recurring task. Pipetower makes it very easy to automate this process with one Action and one Pipe.
A possible extension to this setup would be to install the available updates directly. This could also be controlled by conditions, e.g. to install the updates only if certain packages are listed or not listed.