133 |
chmod 775 $OUTDIR |
chmod 775 $OUTDIR |
134 |
#-- In case a new-outpdir is made, process old files from "postponed" |
#-- In case a new-outpdir is made, process old files from "postponed" |
135 |
# (if any old msg there) by changing INDIR to ../postponed |
# (if any old msg there) by changing INDIR to ../postponed |
136 |
oldMsg=`ls -1 ${INDIR}/../postponed | wc -l` |
if test $monthDir != 0 ; then |
137 |
|
oldMsg=`ls -1 ${INDIR}/../postponed | wc -l` |
138 |
|
fi |
139 |
if test $oldMsg != 0 ; then |
if test $oldMsg != 0 ; then |
140 |
newInD=`dirname $INDIR` |
newInD=`dirname $INDIR` |
141 |
INDIR="$newInD/postponed" |
INDIR="$newInD/postponed" |
159 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
160 |
if test $oldMsg = 0 ; then |
if test $oldMsg = 0 ; then |
161 |
|
|
162 |
#- 1) check that $INDIR is empty |
#- 1) check that $INDIR is empty (except .tar.gz files) |
163 |
nbMsg=`ls -1 $INDIR | wc -l` |
nbMsg=`ls -1 $INDIR | grep -v '\.tar\.gz$' | wc -l` |
164 |
if test $nbMsg != 0 ; then |
if test $nbMsg != 0 ; then |
165 |
date |
date |
166 |
echo "ERROR: '$INDIR' is not empty ! --> exit" |
echo "ERROR: '$INDIR' is not empty ! --> exit" |
168 |
fi |
fi |
169 |
|
|
170 |
nbMsg=0; ORIG=${RHOST}:$M_DIR |
nbMsg=0; ORIG=${RHOST}:$M_DIR |
171 |
#- 2) scp all msg from ORIG to INDIR |
#- 2) scp all msg from ORIG to INDIR |
172 |
cd $INDIR |
cd $INDIR |
173 |
scp -p ${RHOST}:$M_DIR/\* . > $STDOUT 2>&1 |
scp -p ${RHOST}:$M_DIR/msg.\* . > $STDOUT 2>&1 |
174 |
RETVAL=$? |
RETVAL=$? |
175 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
176 |
#echo " RETVAL='$RETVAL'" |
#echo " RETVAL='$RETVAL'" |
183 |
#rm -f $STDOUT |
#rm -f $STDOUT |
184 |
exit 6 |
exit 6 |
185 |
fi |
fi |
186 |
nbMsg=`ls -1 | wc -l` |
listMsg='' ; nbMsg=`ls -1 msg.* 2>/dev/null | wc -l` |
187 |
if test $nbMsg != 0 ; then |
if test $nbMsg != 0 ; then |
188 |
echo "> scp $nbMsg msg from '$ORIG' to '$INDIR'" |
echo "> scp $nbMsg msg from '$ORIG' to '$INDIR'" |
189 |
listMsg=`ls -1` |
listMsg=`ls -1 msg.*` |
190 |
#- And rename msg by adding unique suffix |
#- And rename msg by adding unique suffix |
191 |
for xx in $listMsg ; do |
for xx in $listMsg ; do |
192 |
mv $xx $xx.$sufx |
mv $xx $xx.$sufx |