Linux: User Notifications

Objective

To configure a Linux Worklet in Automox that displays pop-up desktop notifications to active users, alerting them to take action (such as saving open work before a system reboot).

Overview

Linux system daemons (like the Automox Agent) run in non-interactive background sessions. To display a graphical pop-up message to an active logged-in user, the Automox Worklet uses zenity to target the active graphical display session (DISPLAY=:0).

Prerequisites

  • Zenity Utility Installed: The target endpoints must have zenity installed.

    • Debian / Ubuntu: sudo apt-get install -y zenity

    • RHEL / CentOS / Fedora: sudo yum install -y zenity

  • Active Graphical Desktop Environment: The target device must have an active logged-in user session with a running GUI desktop (e.g., GNOME, KDE, XFCE).

Implementation Steps

1.Create a New Linux Worklet Policy:

  1. In the Automox console, navigate to Policies > Create Policy.
  2. Select the Worklet policy type and click the Linux tile.
  3. Enter a descriptive policy name (e.g., Linux - Display Pre-Reboot Desktop Notification).
  4. Associate the Worklet with your target Device Group(s) or configure Device Targeting Filters.

2.Add Evaluation and Remediation Code:

Insert the provided Bash scripts into the respective Evaluation Code and Remediation Code blocks in the console editor.

3.Configure Execution Schedule:

Set your desired execution frequency or schedule under the Schedule section, then click Create Policy.

 

Worklet Code Snippets

Evaluation Code

#!/bin/bash

# Always exit 1 to force execution of the Remediation Code script
exit 1

Remediation Code

#!/bin/bash

#================================================================
# Sends a graphical notification pop-up to active Linux desktops
#================================================================

## Configurable Notification Items
title='Message from Automox'
message_text='Updates require a system reboot: Please save your work.'
width=400
height=100
timeout_duration=60 # Duration in seconds before the notification closes automatically

## Send Notification to Active Users
if command -v zenity &>/dev/null; then
    who | awk '{print $1}' | sort | uniq | while read -r user; do
        sudo -u "$user" DISPLAY=:0 \
        zenity --warning --title="$title" --text="$message_text" \
        --width="$width" --height="$height" --timeout="$timeout_duration"
    done
else
    echo "Error: Zenity is not installed on this system. Please install Zenity and try again."
    exit 1
fi

Testing & Verification

  1. Assign the Worklet Policy to a test Linux device with an active desktop user logged in.

  2. Manually trigger the policy by selecting Run Policy Now on the target device in the console.

  3. Verify that the warning dialog appears on the desktop display and auto-dismisses after the configured timeout duration.

  4. If the notification fails to display, inspect the local agent log (/var/log/automox/amagent.log) or verify that zenity is installed and the target user owns DISPLAY=:0.

Related Articles

Was this article helpful?
1 out of 1 found this helpful