Need help with script to get user ftp logs
Hello,
I'm trying to write a shell script that will grab a users ftp logs and put it in his home dir. The server I will run this script on keeps two plan text logs and the other 6 are compressed with .gz. For example there is auth.log, auth.log.1 auth.log.2.gz ..... auth.log.8.gz I would like to scan all those plus xferlog (which is setup the same way) for a user and have it place a auth.log and xferlog file in the customers root. I have the below script which works but only does it for one file. All help is appreciated. #!/bin/sh DIR=/hsphere/local/var/proftpd/ USER=$1 if [ $# -eq 0 ] then echo "$0 : You must supply username" exit 1 fi if [ -f $DIR/auth.log ] then cat $DIR/auth.log | grep $USER >> /hsphere/local/home/$USER/auth.log else echo "File doesn't exist" fi P.S This is my first time posting to any Forum so please be gentle |
Code:
for file in `ls $DIR/auth.log*` http://www.tldp.org/LDP/abs/html/bas...#REGEXMATCHREF |
Quote:
Code:
for file in $DIR/auth.log* |
Thanks works exactly as needed.
|
All times are GMT -5. The time now is 09:44 AM. |