#!/bin/sh
# This script will ftp a file from yesterday from a server to the local machine then run a command on it
# The lines below are some variables that I defined for various dates. The log file variables can be adjusted to form a filename that has a date in it
todaysdate=`date +%y%m%d`
todayslog=ex`date +%y%m%d`.log
yesterdaysdate=`date --date=yesterday +%y%m%d`
yesterdayslog=ex`date --date=yesterday +%y%m%d`.log
tomorrowdate=`date --date=tomorrow +%y%m%d`
tomorrowslog=ex`date --date=tomorrow +%y%m%d`.log
# The below line just echos info to the screen to show progress
echo Trying to get yesterdays logfile $yesterdayslog
# The below lines will run an FTP script that uses variables from above to get specific files
ftp -n -v ww.xx.yy.zz << EOF
user usernamehere passwordhere
lcd /some/folder/path
get $yesterdayslog
get $todayslog
get $tomorrowslog
quit
EOF
# The below line can be a script or other command
/path/to/script/anyscript.sh
Labels: command line, linux, scripts, utils