Hi,
I'm a newb and I need help please.
A user will be ftping some files to an upload directory. I need to move those files to another directory. I also need to mail a list of the just moved files to the user. This job will need to run every 10 minutes. I need to keep a log that holds all the files for the day that were moved, renaming it with the date/timestamp.
I have this below but I just can't put it all together. Can someone help me make a workable script out of this?
#!/bin/bash
# test.shl
source="/u03/upload/"
dest="/u01/dataload/"
log="/u03/logs/transfer.log"
arch="/u03/logs/transfer_daily.log"
list="ls /u03/transfer/finaid/upload/$1*"
echo $list > /u03/logs/transfer.log
echo $list >> /u03/logs/transfer_daily.log
mv /u03/upload/*.* /u01/dataload/
echo "$list has been copied to dataload directory successsfully" | mail -s "Transfer Complete"
user@work.com
#!/bin/bash
# archlog.shl
mv /u03/logs/transfer_daily.log /u03/logs/transfer_daily_`date +"%Y%m%d%H%M%S"`.log
crontab:
10,20,30,40.50,60 00 * * 0-6 /u03/bin/test.shl # runs every 10 minutes
0 2 * * 0-6 /u03/bin/archlog.shl # runs at 2am
Thanks!