Skip to content

demartini/upml

Logo

upml

Always Up. Always Clean. Always Secure.

Contributors Forks Stargazers Issues License

Table of Contents

About

upml (Update My Linux) is a powerful, elegant, and flexible Bash script designed to automate the maintenance and optimization of Ubuntu servers.

It handles system updates, upgrades, package cleanup, health checks, detailed logging, configuration management, and real-time Discord notifications — including full log file uploads for complete monitoring.

With a clean and professional console output, smart tab completion for all commands, robust error handling, and easily customizable settings, upml is the all-in-one solution to keep your servers secure, updated, efficient, and fully under control — with minimal manual effort.

(back to top)

Features

  • Automated System Maintenance:

    • Fix broken packages
    • Update package lists
    • Upgrade and fully upgrade packages
    • Clean unnecessary and orphaned packages
  • System Health Checks:

    • Display Disk Usage, Memory Usage, and Top Processes
  • Discord Notifications:

    • Real-time notifications for:
      • Update start and completion
      • Errors and issues
      • Reboot status
      • Full log file uploads as attachment
  • Flexible Logging:

    • Logs saved separately by date: /var/log/upml/upml-YYYY-MM-DD-HHMMSS.log
    • Automatic log rotation (deletes logs older than 30 days)
    • Option to specify a custom log file
  • Configuration File:

    • Global settings stored at /etc/upml.conf
    • Easy editing without modifying the script
  • Command-Line Options:

    • Dry-run mode to simulate without executing
    • Option to disable Discord notifications
    • Ability to set or view configuration easily
  • Tab Completion Support:

    • Smart autocompletion for all available command-line options
  • Enhanced Console Output:

    • Beautiful, centered, boxed headers
    • Professional, clean design
  • Advanced Error Handling:

    • Exits on first error
    • Captures line and command that caused errors
    • Sends error alerts via Discord

(back to top)

Installation

1. Create the Discord Webhook (Optional)

Note: Configuring a Discord Webhook is optional. If not configured, Discord notifications will be disabled, but system maintenance will still work normally.

To create a webhook:

  1. Open your Discord server settings.
  2. Navigate to Integrations > Webhooks.
  3. Click New Webhook.
  4. Name your webhook and select the channel where messages will be sent.
  5. Click Copy Webhook URL to copy the generated URL.

You can set your webhook in two ways:

  • During manual installation (when running installer.sh).
  • After installation, using: sudo upml --set-webhook

2.1. Install Using the .deb Package (Recommended)

Step 1: Download the latest .deb package from Releases.

Go to Releases

Step 2: Install the package:

sudo dpkg -i upml_X.X.X.deb

Step 3: (Optional) Fix missing dependencies:

sudo apt-get install -f

This will:

  • Install necessary dependencies (curl, deborphan)
  • Install upml into /usr/local/bin/
  • Create /etc/upml.conf
  • Create /var/log/upml/

2.2. Install Manually Using the Installer Script (Alternative)

Step 1: Install dependencies:

sudo apt update
sudo apt install deborphan curl -y

Step 2: Download the project:

Clone or download the upml project files:

git clone https://github.com/demartini/upml.git
cd upml

(Or manually copy the files.)

Step 3: Make the installer executable:

chmod +x scripts/installer.sh

Step 4: Run the installer:

sudo ./scripts/installer.sh

This will:

  • Install upml into /usr/local/bin/
  • Ask for your Discord Webhook URL
  • Create /etc/upml.conf with settings
  • Create /var/log/upml/

3. Scheduled Maintenance (Optional)

Automate maintenance with cron. For example, every Sunday at 2:00 AM:

sudo crontab -e

Add:

0 2 * * SUN /usr/local/bin/upml

(back to top)

Configuration

upml uses a configuration file located at /etc/upml.conf.

You can manually edit this file to change settings:

Variable Description
DISCORD_WEBHOOK (Optional) Discord Webhook URL for alerts.
LOG_DIR Directory where log files will be saved.

Example of /etc/upml.conf:

DISCORD_WEBHOOK="https://discord.com/api/webhooks/your_webhook_here"
LOG_DIR="/var/log/upml"

If no webhook is configured, upml will still run but will not send Discord notifications.

(back to top)

Usage

Command Description
upml -d, --dry-run Simulate all operations without making any changes.
upml -n, --no-discord Disable all Discord notifications.
upml -l, --logfile <path> Save log output to a custom file instead of /var/log/upml/upml-YYYY-MM-DD.log.
upml -s, --set-webhook Set or update your Discord Webhook URL in /etc/upml.conf.
upml -c, --show-config Display the current configuration (Webhook and Log Directory).
upml -h, --help Show help information for available options.
upml -v, --version Display the current version of upml.

Examples

Run normally:

sudo upml

Simulate operations (no changes):

sudo upml --dry-run

Run without sending Discord notifications:

sudo upml --no-discord

Save logs to a custom location:

sudo upml --logfile /tmp/upml-test.log

Combine multiple options:

sudo upml --dry-run --no-discord --logfile /tmp/test.log

(back to top)

Uninstallation

To completely remove upml:

If you installed using the .deb package:

sudo apt remove upml

If you installed manually, run:

Step 1: Make the uninstaller executable:

chmod +x scripts/uninstaller.sh

Step 2: Run the uninstaller:

sudo ./scripts/uninstaller.sh

(back to top)

Contributing

If you are interested in helping contribute, please take a look at our contribution guidelines and open an issue or pull request.

(back to top)

Changelog

See CHANGELOG for a human-readable history of changes.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

Bash script for secure and efficient Ubuntu server maintenance with full automation and real-time monitoring.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors