Skip to content

Instantly share code, notes, and snippets.

@iyank4
Created April 25, 2013 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iyank4/5457381 to your computer and use it in GitHub Desktop.
Save iyank4/5457381 to your computer and use it in GitHub Desktop.
Script for dump and compress some mysql database
#!/bin/sh
WAKTU=$(date +%Y%m%d_%H%I%S_%Z)
if [ -f alldump.sql ];
then
rm alldump.sql
fi
if [ -f alldump.sql.tar.gz ];
then
rm alldump.sql.tar.gz
fi
mysqldump -u root -p -x --databases NAMA_DB1 NAMA_DB2 > alldump.sql
tar cvzf "alldump_$WAKTU.sql.tar.gz" alldump.sql.
rm alldump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment