I need a cron script (either php or shell) that will:
- delete all mp3's in a given directory
- use wget to download the "new" mp3's
- if wget failed (404 or any other reason) email (using sendmail) an error report
- if wget downloaded the files successfully, chmod a remote directory (the remote server is a Mac, so the permissions change at will!), then scp them to the remote server (Mac, so wget doesn't work so well...or I'd run the script on that server)
- if the scp didn't work (permissions, internet connection or any other reason) sendmail an error report
I have everything working except the emailing of the error report....and the chmod.
Here's what I have:
cp /backup.mp3 /var/www/showdownloads/XXX/backup.mp3
wget -nd -r -l1 --no-parent -A.mp3 ftp://XXX:XXXX@XXX.XXX.XXX.XXX/directory/
scp *.mp3 firstname.lastname@example.org:"/Volumes/XXX"