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:
Code:
#!/bin/sh
set -e
cp /backup.mp3 /var/www/showdownloads/XXX/backup.mp3
cd /var/www/showdownloads/XXX
rm *.mp3
wget -nd -r -l1 --no-parent -A.mp3 ftp://XXX:XXXX@XXX.XXX.XXX.XXX/directory/
scp *.mp3 downloads@192.168.2.169:"/Volumes/XXX"
exit
Any ideas?
Thanks!
Recent comments
9 hours 25 min ago
14 hours 24 min ago
15 hours 50 min ago
16 hours 43 min ago
18 hours 26 min ago
22 hours 50 min ago
23 hours 42 min ago
1 day 1 hour ago
1 day 15 hours ago
1 day 16 hours ago