From c4a23af7409546a3dee1308ace06626b380229ea Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Wed, 28 May 2025 09:50:25 +0200 Subject: [PATCH] feat(scripts): Suppress housekeeping cron output Allow optional logging in the NetBox housekeeping script. Users can choose silent execution or log to a file. --- contrib/netbox-housekeeping.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/netbox-housekeeping.sh b/contrib/netbox-housekeeping.sh index 5b1c46c5e..781423041 100755 --- a/contrib/netbox-housekeeping.sh +++ b/contrib/netbox-housekeeping.sh @@ -6,4 +6,16 @@ # # If NetBox has been installed into a nonstandard location, update the paths # below. -/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping +# By default, all output is discarded. Uncomment the log lines below to enable +# logging. + +# Run quietly (no log) +# -------------------- +/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping > /dev/null 2>&1 + +# Run with logging (append output to log file) +# -------------------------------------------- +# LOGFILE="/var/log/netbox/housekeeping.log" +# echo "[$(date)] Starting NetBox housekeeping..." >> "$LOGFILE" +# /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping >> "$LOGFILE" 2>&1 +# echo "[$(date)] NetBox housekeeping complete." >> "$LOGFILE"