Article 55KFZ Script to check files - different file names

Script to check files - different file names

by
orangepeel190
from LinuxQuestions.org on (#55KFZ)
Hi All,

I was wondering if someone would be able to check my script....

I am wishing to download a file from the mater website, if that website or file is not present, it will redirect to a backup server - and try and source the file from there

Bash Script....

Code:/usr/bin/wget https://drive.google.com/drive/path/here/$FILE1 || \
/usr/bin/wget http://www.second.webserver/$FILE2 \\ error 1

if [ -f $FILE1 ]; then
echo ".... SUCCESS !!! $FILE1 downloaded from Master Site....."
else

[ -f $FILE2 ] then
echo ".... SUCCESS !!! $FILE2 downloaded from backup site....."
fi

exit 0;;The Google address is proving temperamental (must be missing something in the URL), but I am having issues trying to checking which File was downloaded in the IF/FI statement so that when whichever file was downloaded - the correct statement was displayed

Thought to give it a try, but I am going around in circles to find out what is wrong and missing.

Would curl be a better option than wget for the download?

Code:/usr/bin/curl -sSkLo $FILE1 https://drive.google.com/drive/path/here/$FILE1 || \
/usr/bin/curl -sSkLo $FILE2 http://www.second.webserver/$FILE2 || error 1

if [ -f $FILE1 ]; then
echo ".... SUCCESS !!! $FILE1 downloaded from Master Site....."
else

[ -f $FILE2 ] then
echo ".... SUCCESS !!! $FILE2 downloaded from backup site....."
fi

exit 0;;What part is fowling up?latest?d=yIl2AUoC8zA latest?i=FZ4MDYoY5wA:p_6WGEDAmLk:F7zBnMy latest?i=FZ4MDYoY5wA:p_6WGEDAmLk:V_sGLiP latest?d=qj6IDK7rITs latest?i=FZ4MDYoY5wA:p_6WGEDAmLk:gIN9vFwFZ4MDYoY5wA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments