I'm trying to write a script to: 1 - download several mp3's 2 - if they downloaded, rename the files 3 - if they didn't download...exit script 4 - if they did download, scp them to another server (I haven't written this part yet...wanted to get the first part working first.) Here's what I have so far: Code: #!/bin/sh set -e cd /var/www/testing/ wget -nd -r -l1 --no-parent --no-passive-ftp -A.mp3 'ftp://username:password@IP' if [ -e /var/www/testing/MIXWX.mp3.1 ]; then echo `rm Mix\ 2p.mp3` echo `cp MIXWX.mp3.1 Mix\ 2p.mp3` echo `rm MIXWX.mp3` echo `rm MIXWX.mp3.1` else echo `` if [ -e /var/www/testing/REALWX.mp3.1 ]; then echo `rm Real\ 2p.mp3` echo `cp REALWX.mp3.1 Real\ 2p.mp3` echo `rm REALWX.mp3` echo `rm REALWX.mp3.1` else echo `` if [ -e /var/www/testing/TALKWX.mp3.1 ]; then echo `rm Talk\ 2p.mp3` echo `cp TALKWX.mp3.1 Talk\ 2p.mp3` echo `rm TALKWX.mp3` echo `rm TALKWX.mp3.1` else echo `` if [ -e /var/www/testing/WMIS.mp3.1 ]; then echo `rm Talk\ 2p.mp3` echo `cp WMIS.mp3.1 WMIS\ 2p.mp3` echo `rm WMIS.mp3` echo `rm WMIS.mp3.1` else echo `` if [ -e /var/www/testing/Current.mp3 ]; then echo `rm Current.mp3` else echo `` exit I'm getting this error: Any ideas what I'm doing wrong? Thanks!
so that would be the same as not defining it at all ;-) Code: #!/bin/bash cd /var/www/testing/ wget -nd -r -l1 --no-parent --no-passive-ftp -A.mp3 'ftp://username:password@IP' if [ -e MIXWX.mp3.1 ]; then echo `rm Mix_2p.mp3` echo `cp MIXWX.mp3.1 Mix_2p.mp3` echo `rm MIXWX.mp3` echo `rm MIXWX.mp3.1` fi if [ -e REALWX.mp3.1 ]; then echo `rm Real_2p.mp3` echo `cp REALWX.mp3.1 Real_2p.mp3` echo `rm REALWX.mp3` echo `rm REALWX.mp3.1` fi if [ -e TALKWX.mp3.1 ]; then echo `rm Talk_2p.mp3` echo `cp TALKWX.mp3.1 Talk_2p.mp3` echo `rm TALKWX.mp3` echo `rm TALKWX.mp3.1` fi if [ -e WMIS.mp3.1 ]; then echo `rm Talk_2p.mp3` echo `cp WMIS.mp3.1 WMIS_2p.mp3` echo `rm WMIS.mp3` echo `rm WMIS.mp3.1` fi if [ -e Current.mp3 ]; then echo `rm Current.mp3` fi exit
Is there a way to write this so that it retries to download the file after a minute if the remote server isn't reachable?