|
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
|