From 4330a538560423a7546d9bbe1c734c7595839ec6 Mon Sep 17 00:00:00 2001 From: Pete Date: Sat, 25 Feb 2017 22:50:38 -0500 Subject: [PATCH] stderr redirects when listing logfiles If a logfile does not exist, certain ls commands generate stderr output. --- usr/lib/nsmnow/lib-nsm-common-utils | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/lib/nsmnow/lib-nsm-common-utils b/usr/lib/nsmnow/lib-nsm-common-utils index 8b4768f..1bbe8da 100644 --- a/usr/lib/nsmnow/lib-nsm-common-utils +++ b/usr/lib/nsmnow/lib-nsm-common-utils @@ -1097,7 +1097,7 @@ process_restart() # Rotate the log file and keep a maximum of 10 [ -f "$LOG_FILE" ] && mv "$LOG_FILE" "$LOG_FILE".`date +%Y%m%d%H%M%S` - [ `ls "$LOG_FILE".* |wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f + [ `ls "$LOG_FILE".* 2>/dev/null|wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f # Start the process if [ "$#" -eq "6" ]; then @@ -1154,7 +1154,7 @@ process_restart_if_stale() process_stop "$APP" "$PID_FILE" "$APP_DESC" # Rotate the log file and keep a maximum of 10 [ -f "$LOG_FILE" ] && mv "$LOG_FILE" "$LOG_FILE".`date +%Y%m%d%H%M%S` - [ `ls "$LOG_FILE".* |wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f + [ `ls "$LOG_FILE".* 2>/dev/null|wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f if [ "$#" -eq "6" ]; then process_start "$APP" "$APP_OPTIONS" "$PID_FILE" "$LOG_FILE" "$APP_DESC" "$USER" else @@ -1213,7 +1213,7 @@ process_restart_with_overlap() else # Rotate the log file and keep a maximum of 10 [ -f "$LOG_FILE" ] && mv "$LOG_FILE" "$LOG_FILE".`date +%Y%m%d%H%M%S` - [ `ls "$LOG_FILE".* |wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f + [ `ls "$LOG_FILE".* 2>/dev/null|wc -l` -gt 10 ] && ls "$LOG_FILE".* |head -1 |xargs rm -f rm -f $PID_FILE process_start "$APP" "$APP_OPTIONS" "$PID_FILE" "$LOG_FILE" "$APP_DESC"