Skip to content

Backups ... properly

Today i found this little script which does backups on a server:

----- cut -----

#!/bin/bash

cd /home/Backup/

DATE=`/bin/date "+%d.%m.%y"`

WEB="web-($DATE).tar"
SQL="sql-($DATE).tar"

tar -cvf "$WEB" /var/lib/mysql
tar -cvf "$SQL" /var/www

exit 0

----- cut -----

Ok, let me count:

1) no check, if the cd fails

2) no packer used

3) no errorchecking at all for the tar (disk full as example)

4) copying the open database files is always a bad idea[tm], mysqldump exists

5) and now check out, which variable name is used for which backup ...