From e6bcc2276b8c06190229159ff990b1a0dd2b267d Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 2 Aug 2026 21:16:34 +0800 Subject: Rename to pub/sub. --- producer.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 producer.sh (limited to 'producer.sh') diff --git a/producer.sh b/producer.sh deleted file mode 100644 index 4e9ec41..0000000 --- a/producer.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -FIFO_PATH="${QUEUE_PATH:-/tmp/job_queue.txt}" - -# Validate argument -if [ $# -eq 0 ] || [ -z "$1" ]; then - echo "Usage: $0 \"message to publish\"" >&2 - exit 1 -fi - -MESSAGE="$1" - -# Ensure the FIFO exists (create if missing) -touch "$FIFO_PATH" 2>/dev/null || { - echo "[$(date '+%H:%M:%S')] ERROR: Failed to access queue file at $FIFO_PATH" >&2 - exit 1 -} - -# Publish message to the FIFO -if echo "$MESSAGE" >> "$FIFO_PATH" 2>/dev/null; then - # Format and cap log line at 72 chars - log_line="[$(date '+%H:%M:%S')] Published: ${MESSAGE}" - if [ ${#log_line} -gt 72 ]; then - printf "[%s] Published: %.45s...\n" "$(date '+%H:%M:%S')" "$MESSAGE" - else - echo "$log_line" - fi -else - echo "[$(date '+%H:%M:%S')] ERROR: Failed to write to FIFO at $FIFO_PATH" >&2 - exit 1 -fi -- cgit v1.2.3