scp/ssh tail(multiple file) remote copy
I currently have a crontab running a script like so..............
/usr/bin/scp firstname.lastname@example.org:/data/noaa/bigross/'*.Z' /data/products/hrpt/bigross/
/usr/bin/scp email@example.com:/data/noaa/ross/'*.Z' /data/products/hrpt/ross/
/usr/bin/scp firstname.lastname@example.org:/data/noaa/mcmu/'*.Z' /data/products/hrpt/mcmu/
/usr/bin/scp email@example.com:/data/noaa/spole/'*.Z' /data/products/hrpt/southpole/
I want to incorporate something like ls -tr | tail -3, so I can get the last three files to date, instead of all. I don't mind changing the script to use ssh login first. Please advise. Thanks Ahead.
Not sure I grasp what you want to do, but a loop should work. I can't think of a way to lump all the filenames into one command, so this would require either RSA key login, or a password entry each time.
for FILE in `ls -tr | tail -3`
scp user@host /path/$FILE .
Or you could look into using rsync, which copies only updated files and can use ssh as the connect protocol.
|All times are GMT -5. The time now is 05:07 AM.|