From cb5ed31fd6e718676c07cf96f2289c8752fb0752 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Mon, 18 May 2026 11:41:02 -0600 Subject: [PATCH] notify message donesies --- customscripts/notify-shell-users.sh | 38 ++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/customscripts/notify-shell-users.sh b/customscripts/notify-shell-users.sh index 4d3d381..3b0899c 100644 --- a/customscripts/notify-shell-users.sh +++ b/customscripts/notify-shell-users.sh @@ -5,4 +5,40 @@ else msg="$1" fi clear -echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\033[31mFOOOKN $msg IN PROGRESS DONT FUCK WITH ANYTHNG\e[0m\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" \ No newline at end of file + +broadcast_pty() { + # Check if a message was provided + if [ -z "$1" ]; then + echo "Usage: broadcast_pty \"Your message here\"" >&2 + return 1 + fi + + # Check for root/sudo privileges (required to write to other users' PTYs) + if [ "$EUID" -ne 0 ]; then + echo "Error: This function must be run as root or with sudo." >&2 + return 1 + fi + + local message="$1" + local timestamp + timestamp=$(date +"%H:%M:%S") + + echo "Broadcasting message to all active terminals..." + + # Loop through all numeric entries in /dev/pts/ + for pty in /dev/pts/[0-9]*; do + # Ensure it's an actual character device file before writing + if [ -c "$pty" ]; then + # Send the message with a clear broadcast banner + { + echo "" + echo "=== SYSTEM BROADCAST ($timestamp) ===" + echo -e "$message" + echo "=====================================" + echo "" + } > "$pty" 2>/dev/null + fi + done +} + +broadcast_pty "\n\n\n\n\n\n\n\n\n\n\n\n\n\033[31mFOOOKN $msg IN PROGRESS DONT FUCK WITH ANYTHNG\e[0m\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" \ No newline at end of file