Changeset d371dd6


Ignore:
Timestamp:
08/14/13 13:09:28 (14 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
94d3a40
Parents:
426025b
Message:

Fix a bug causing the script to fail when the log files got too large

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/lpreserver/backend/functions.sh

    r7e703b7 rd371dd6  
    1313DBDIR="/var/db/lpreserver" 
    1414if [ ! -d "$DBDIR" ] ; then mkdir -p ${DBDIR} ; fi 
     15 
    1516CMDLOG="${DBDIR}/lp-lastcmdout" 
    1617CMDLOG2="${DBDIR}/lp-lastcmdout2" 
     
    1920REPLOGSEND="${LOGDIR}/lastrep-send-log" 
    2021REPLOGRECV="${LOGDIR}/lastrep-recv-log" 
    21 export DBDIR LOGDIR PROGDIR CMDLOG REPCONF REPLOGSEND REPLOGRECV 
     22MSGQUEUE="${DBDIR}/.lpreserver.msg.$$" 
     23export DBDIR LOGDIR PROGDIR CMDLOG REPCONF REPLOGSEND REPLOGRECV MSGQUEUE 
    2224 
    2325# Create the logdir 
    2426if [ ! -d "$LOGDIR" ] ; then mkdir -p ${LOGDIR} ; fi 
    25  
    26 MSGQUEUE="" 
    27 export MSGQUEUE 
    2827 
    2928#Set our Options 
     
    151150 
    152151queue_msg() { 
    153   MSGQUEUE="$MSGQUEUE $@"  
     152  echo -e "$1" >> ${MSGQUEUE} 
     153  if [ -n "$2" ] ; then 
     154    cat $2 >> ${MSGQUEUE} 
     155  fi 
    154156} 
    155157 
    156158echo_queue_msg() { 
    157   echo -e "$MSGQUEUE" 
     159  if [ ! -e "$MSGQUEUE" ] ; then return ; fi 
     160  cat ${MSGQUEUE} 
     161  rm ${MSGQUEUE} 
    158162} 
    159163 
     
    294298  $zSEND 2>${REPLOGSEND} | $zRCV >${REPLOGRECV} 2>${REPLOGRECV} 
    295299  zStatus=$? 
    296   queue_msg "ZFS SEND LOG:\n--------------\n`cat ${REPLOGSEND}`\n\n" 
    297   queue_msg "ZFS RCV LOG:\n--------------\n`cat ${REPLOGRECV}`\n\n" 
     300  queue_msg "ZFS SEND LOG:\n--------------\n" "${REPLOGSEND}" 
     301  queue_msg "ZFS RCV LOG:\n--------------\n`" "${REPLOGRECV}" 
    298302 
    299303  if [ $zStatus -eq 0 ] ; then 
Note: See TracChangeset for help on using the changeset viewer.