Skip to content

Instantly share code, notes, and snippets.

@arran4
Last active December 18, 2015 05:39
Show Gist options
  • Save arran4/5733881 to your computer and use it in GitHub Desktop.
Save arran4/5733881 to your computer and use it in GitHub Desktop.
#!/bin/bash
BASEDIR="/home/arran/backup"
BDIR="$BASEDIR/`date +%F`/"
BISO="$BASEDIR/`date +%F`.iso"
BDIR_MYSQL="$BASEDIR/`date +%F`/mysql/"
BDIR_SCM="$BASEDIR/`date +%F`/scm"
echo "Creating file system"
mkdir -p "$BDIR" "$BDIR_MYSQL" "$BDIR_SCM"
echo "Generating mysql dump"
time mysqldump -u mysqlbackup -p'..........' --all-databases | bzip2 > "$BDIR_MYSQL/backup.sql.bz2"
echo "Generating tar"
time tar -cjf "$BDIR_SCM/scm.tar.bz2" -C /home/arran/.scm/ /home/arran/.scm/
echo "Generating iso $BISO"
time genisoimage -jcharset UTF-8 -R -o "$BISO" "$BDIR"
echo "Done"
du -sh "$BASEDIR"/*
arran@JungSooRi 6713% ./script.sh
Creating file system
Generating mysql dump
real 0m15.524s
user 0m14.769s
sys 0m0.280s
Generating tar
tar: Removing leading `/' from member names
real 1m4.623s
user 1m3.956s
sys 0m0.840s
Generating iso /home/arran/backup/2013-06-08.iso
Warning: creating filesystem with Joliet extensions but without Rock Ridge
extensions. It is highly recommended to add Rock Ridge.
5.90% done, estimate finish Sat Jun 8 13:22:17 2013
11.79% done, estimate finish Sat Jun 8 13:22:17 2013
17.66% done, estimate finish Sat Jun 8 13:22:17 2013
23.56% done, estimate finish Sat Jun 8 13:22:17 2013
29.43% done, estimate finish Sat Jun 8 13:22:17 2013
35.33% done, estimate finish Sat Jun 8 13:22:17 2013
41.20% done, estimate finish Sat Jun 8 13:22:17 2013
47.10% done, estimate finish Sat Jun 8 13:22:17 2013
52.97% done, estimate finish Sat Jun 8 13:22:17 2013
58.87% done, estimate finish Sat Jun 8 13:22:17 2013
64.75% done, estimate finish Sat Jun 8 13:22:17 2013
70.64% done, estimate finish Sat Jun 8 13:22:17 2013
76.52% done, estimate finish Sat Jun 8 13:22:17 2013
82.41% done, estimate finish Sat Jun 8 13:22:17 2013
88.29% done, estimate finish Sat Jun 8 13:22:17 2013
94.18% done, estimate finish Sat Jun 8 13:22:17 2013
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 4238
Path table size(bytes): 36
Max brk space used 1a000
84954 extents written (165 MB)
real 0m0.240s
user 0m0.028s
sys 0m0.212s
Done
166M /home/arran/backup/2013-06-08
166M /home/arran/backup/2013-06-08.iso
4.0K /home/arran/backup/script.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment