[luau] database backup script

Rod Gammon AEG-Inc at hawaii.rr.com
Sat Mar 23 22:58:08 PST 2002


Aloha-

A while back this list gave me advice on how to insert current date into a
script.  What the heck, the script is below- suitable for backing up a mysql
database and emailing you a notice.

Here's a tough one (maybe).  How to write another script that would take an
input file, each of whose lines was a param list, and call the script below?

-rg

# mySqlBack.sh - Shell script to dump mysql db to file
# Zips Mysql to file in supplied directory named <dbname><date>.mysql
# $1 = user name
# $2 = password
# $3 = hostname
# $4 = db name
# $5 = destination directory (leave off final '/')
# $6 = email address to send notification to

OUTPUT_NAME=$5/$4.`date '+%d.%m.%Y.%H.%M'`.mysql
mysqldump -u $1 --password=$2 -h $3 $4 > $OUTPUT_NAME
zip $OUTPUT_NAME.zip $OUTPUT_NAME
rm $OUTPUT_NAME
(
  echo "To: " $6
  echo -n "Subject: New backup for Mysql DB " $4
  echo; echo; echo;
  echo "File name: " $OUTPUT_NAME
) | /usr/lib/sendmail -oi -oe -t




More information about the LUAU mailing list