The article provides instructions on running GUI programs with cron in Linux and monitoring root filesystem disk usage using notify-send and setting environment variables. It also includes a script for disk usage monitoring that sends alerts when the root filesystem has less than 10% free space.

the ultimate solution:

copy all current user environment variables to crontab.


to run notify-send you have to set DBUS_SESSION_BUS_ADDRESS


to run other gui programs you set DISPLAY and XAUTHORITY


wall works for tmux and ssh sessions but not gnome-terminal.

in kde everything works fine. install konsole instead.


script for monitoring disk usage:

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
used_percentage=$(df / | awk 'NR==2 {sub(/%/, "", $5); print $5}')
alarm_message="Root filesystem has less than 10% free space."
# Compare the percentage with the number 90
if [ "$used_percentage" -lt 90 ]; then
echo "Disk is ok."
else
wall $alarm_message
notify-send $alarm_message
fi

Comments