Ofer Schreiber has uploaded a new change for review.

Change subject: packaging: log rotation - do not execute ls on non-existing 
files
......................................................................

packaging: log rotation - do not execute ls on non-existing files

Due to the usage of ls, ovirtlogrot.sh would print error messages if it
couldn't find any file matching the pattern engine.log.*
This patch removes the execution of ls, and therefore, removes the error
messages.

Change-Id: Icb3d443dd26c6e22302a694c1d0f433383f312b7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=889751
Signed-off-by: Ofer Schreiber <oschr...@redhat.com>
---
M packaging/resources/ovirtlogrot.sh
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/14097/1

diff --git a/packaging/resources/ovirtlogrot.sh 
b/packaging/resources/ovirtlogrot.sh
index 30d0def..c037b4a 100755
--- a/packaging/resources/ovirtlogrot.sh
+++ b/packaging/resources/ovirtlogrot.sh
@@ -11,9 +11,9 @@
 
 date=`date $dateformat`
 
-for i in `ls $logdir/{engine,server,jasperserver}.log.* -t`; do
+for i in $logdir/{engine,server,jasperserver}.log.*; do
  m=`expr match $i '.*\(gz\|xz\)'`
- if [ -z "$m" ]
+ if [[ -z "$m" && -w "$i" ]]
  then
   cat $i | xz > $i-${date}_`/bin/date +%N | cut -c6-`.xz && rm $i
  fi
@@ -24,7 +24,7 @@
 #
 
 lastlogday=`date -d "$maxage hours ago" $dateformat`
-for i in `ls $logdir/{engine,server,jasperserver}.log.*.{gz,xz}`; do
+for i in $logdir/{engine,server,jasperserver}.log.*.{gz,xz}; do
  timestamp=`echo $i | sed 's/.*-//; s/\.\(gz\|xz\)$//; s/_.\{4\}$//'`
  if [[ "$lastlogday" > "$timestamp" ]]
  then


--
To view, visit http://gerrit.ovirt.org/14097
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb3d443dd26c6e22302a694c1d0f433383f312b7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ofer Schreiber <oschr...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to