]> git.99rst.org Git - openwrt-packages.git/commitdiff
nut: add process id to log messages
authorDaniel F. Dickinson <redacted>
Sat, 18 Jul 2026 22:49:27 +0000 (18:49 -0400)
committerJosef Schlehofer <redacted>
Sun, 19 Jul 2026 09:23:51 +0000 (11:23 +0200)
Show the PID beside the syslog_id to aid debugging.

Signed-off-by: Daniel F. Dickinson <redacted>
net/nut/files/libhid-ups.hotplug
net/nut/files/nut-cgi.init
net/nut/files/nut-common.sh.functions
net/nut/files/nut-monitor.init
net/nut/files/nut-sendmail-notify
net/nut/files/nut-serial.hotplug
net/nut/files/nut-server.init

index 93ec81ec02306ae2ca9eeb84b80591057dce5682..0400b28b70129e4de5b75dd332680b6bb85f1595 100644 (file)
@@ -16,7 +16,7 @@
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-usb-hotplug "Unable to source 'functions.sh' in 'libhid-ups' hotplug. Bailing"
+       logger -t nut-usb-hotplug[$$] "Unable to source 'functions.sh' in 'libhid-ups' hotplug. Bailing"
        exit 1
 }
 
@@ -26,7 +26,7 @@
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-usb-hotplug "Unable to source 'nut-common.sh' in 'libhid-ups' hotplug. Bailing"
+       logger -t nut-usb-hotplug[$$] "Unable to source 'nut-common.sh' in 'libhid-ups' hotplug. Bailing"
        exit 1
 }
 
index f7e256a2f62d5b006b720401c57b213c3c227cca..9cd65089d6497d165a58acbf2611283669039a87 100644 (file)
@@ -35,7 +35,7 @@ UPSCGI_HOSTS_CONF="${UPSCGI_CONF_DIR}/hosts.conf"
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-cgi "Unable to source 'functions.sh'"
+       logger -t nut-cgi[$$] "Unable to source 'functions.sh'"
        exit 1
 }
 
@@ -45,7 +45,7 @@ UPSCGI_HOSTS_CONF="${UPSCGI_CONF_DIR}/hosts.conf"
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-cgi "Failed to load nut-common.sh"
+       logger -t nut-cgi[$$] "Failed to load nut-common.sh"
        exit 1
 }
 
index 1b8a2a26fe09b28da21ccd3ae0ac99b565ebaa91..258e9861e322134874b1fb350ba4a0b7cd27d0d8 100644 (file)
@@ -185,7 +185,7 @@ log_msg() {
        local level="${4:-notice}"
        local facility="${5:-daemon}"
 
-       logger -t "$syslog_id" -p "${facility}.${level}" "'$reason' in '$current_script'" || {
+       logger -t "${syslog_id}[$$]" -p "${facility}.${level}" "'$reason' in '$current_script'" || {
                # We use 'tr' as changing case via variable parameter substitution is not available in ash on OpenWrt
                # shellcheck disable=SC2018,SC2019
                level="$(echo "$level" | tr 'a-z' 'A-Z')"
index ae283033718a7ae2fc5eb82d0947611027181248..eb4f80ad9df1c419dd0d9408912e90d2f57dc9a1 100644 (file)
@@ -18,7 +18,7 @@ USE_PROCD=1
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-monitor "Unable to source 'functions.sh' in 'nut-monitor'. Bailing"
+       logger -t nut-monitor[$$] "Unable to source 'functions.sh' in 'nut-monitor'. Bailing"
        exit 1
 }
 
@@ -28,7 +28,7 @@ USE_PROCD=1
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-monitor "Unable to source 'nut-common.sh' in 'nut-monitor'. Bailing"
+       logger -t nut-monitor[$$] "Unable to source 'nut-common.sh' in 'nut-monitor'. Bailing"
        exit 1
 }
 
index b49de4bde3b49e0cef004c346f9448dfcdc21f26..cd26c1ed419e40b26bb6d3712e993bc7e48b1c3e 100644 (file)
@@ -15,7 +15,7 @@
 
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
-       logger -t nut-sendmail-notify "Unable to source 'functions.sh' in 'nut-sendmail-notify'. Bailing"
+       logger -t nut-sendmail-notify[$$] "Unable to source 'functions.sh' in 'nut-sendmail-notify'. Bailing"
        exit 1
 }
 
@@ -24,7 +24,7 @@
 # shellcheck disable=SC1094
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
-       logger -t nut-sendmail-notify "Unable to source 'nut-common.sh' in 'nut-sendmail-notify'. Bailing"
+       logger -t nut-sendmail-notify[$$] "Unable to source 'nut-common.sh' in 'nut-sendmail-notify'. Bailing"
        exit 1
 }
 
@@ -33,7 +33,7 @@ log_send_failure_and_exit() {
        local reason="$1"
        local syslog_id="nut-sendmail-notify"
        local message_prefix="Message was not sent"
-       logger -t "$syslog_id" "${message_prefix}: $reason" || {
+       logger -t "${syslog_id}[$$]" "${message_prefix}: $reason" || {
                printf "%s: %s: %s, and logging failed\n" "$syslog_id" "$message_prefix" "$reason" >&2
        }
        exit 1
index 3669a0c5ca375019375c5e19bd1b628c3638096d..9da375df8e7a096dca41058d1ef70d0bdfc4506c 100644 (file)
@@ -16,7 +16,7 @@
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-serial-hotplug "Unable to source 'functions.sh' in 'nut-serial' hotplug. Bailing"
+       logger -t nut-serial-hotplug[$$] "Unable to source 'functions.sh' in 'nut-serial' hotplug. Bailing"
        exit 1
 }
 
@@ -26,7 +26,7 @@
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t nut-serial-hotplug "Unable to source 'nut-common.sh' in 'nut-serial' hotplug. Bailing"
+       logger -t nut-serial-hotplug[$$] "Unable to source 'nut-common.sh' in 'nut-serial' hotplug. Bailing"
        exit 1
 }
 
index 5b6d35f7959f18ebe0a5780bc46649b7584d61b6..8a80d2ede34e10c5cef4e2ddbc42014397e98a49 100644 (file)
@@ -29,7 +29,7 @@ USE_PROCD=1
 # shellcheck source=net/nut/files/functions.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t "nut-server" "FATAL: Unable to source 'functions.sh' in 'nut-server'"
+       logger -t "nut-server[$$]" "FATAL: Unable to source 'functions.sh' in 'nut-server'"
        exit 1
 }
 
@@ -39,7 +39,7 @@ USE_PROCD=1
 # shellcheck source=net/nut/files/nut-common.sh.functions
 . "${IPKG_INSTROOT}"/lib/functions/nut/nut-common.sh || {
        # Before our sourcing error logging definitions are sourced
-       logger -t "nut-server" "FATAL: Unable to source 'nut-common.sh' in 'nut-server'"
+       logger -t "nut-server[$$]" "FATAL: Unable to source 'nut-common.sh' in 'nut-server'"
        exit 1
 }
 
@@ -397,7 +397,7 @@ reload_ups_driver() {
 
 stop_service_if_no_instances() {
        if service_active_no_instances "nut-server"; then
-               logger -s -t "nut-server" "nut-server active with no instances"
+               logger -t "nut-server" "nut-server active with no instances"
                # If "nut-server" is active with no instances
                # We don't care about the exit code of procd_kill, and logging its
                # stderr can aid debugging.
git clone https://git.99rst.org/PROJECT