Keeping your Ubuntu server healthy requires more than installing package updates. Over time, unused packages, cached APT files, and Docker resources can consume valuable disk space and affect system performance.

By automating routine maintenance with cron, you can ensure your server stays secure, up to date, and clean without manual intervention.

In this guide, you'll create a maintenance script that:

Updates package lists

Installs available package upgrades