1751978 Members
4517 Online
108784 Solutions
New Discussion юеВ

Moving logs

 
SOLVED
Go to solution
Allanm
Super Advisor

Moving logs


I am doing the following for moving logs from an archived logs location to another filesystem. I am using pax to maintain the directory structure -

#for i in `cat tmp`
> do
> pax $i /data5/logs && rm $i
> done


Where tmp contains -


./reg/cc4/app/ap2.qbo20070402.log.gz
./reg/cc4/app/admin.qbo20070403.log.gz
./reg/cc4/app/ap1.qbo20070403.log.gz
./reg/cc4/app/ap2.qbo20070403.log.gz
./reg/cc4/app/admin.qbo20070404.log.gz
./reg/cc4/app/ap1.qbo20070404.log.gz
./reg/cc4/app/ap2.qbo20070404.log.gz

....

But from what I am noticing its just not writing the logs to the new location.. Is something wrong with the for statement I am using above.( and I am also not seeing any errors while its just running)
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: Moving logs

Hi:

> But from what I am noticing its just not writing the logs to the new location

That's because you didn't tell 'pax' to do that. You might want:

# pax -rw ./ /data5/logs

THe use of the 'cat' to read your file of file names is useless overhead. Instead, do:

while read FILE X
do
pax -rw ./${FILE} /data5/logs && rm ./${FILE}
done < /tmp/filelist

...where '/tmp/filelist' contains the filenames, one per line as you noted.

Regards!

...JRF...




Allanm
Super Advisor

Re: Moving logs

Thanks