Backup MySQL Vtiger Database and compress it with zip

Here is a one-liner to backup your VTiger database, give it a timestamp and zip it.

export TMPDATE=$(date +%Y%m%d-%H%M); mysqldump -p vtigercrm50 > $TMPDATE"_vtigercrm50.sql" ; zip $TMPDATE"" $TMPDATE"_vtigercrm50.sql" ; rm $TMPDATE"_vtigercrm50.sql"

Some explanation:


Create a timestamp and save it in a variabel named TMPDATE

export TMPDATE=$(date +%Y%m%d-%H%M)

Dump the database and give is a name with the timestamp

mysqldump -p vtigercrm50 > $TMPDATE"_vtigercrm50.sql"

Zip the sql file

zip $TMPDATE"" $TMPDATE"_vtigercrm50.sql"

Delete the sql file

rm $TMPDATE"_vtigercrm50.sql"

Al whats left is a compressed dump of the vtiger database named (Where YYMMDD-HHMM is the current date and time)

Post new comment
The content of this field is kept private and will not be shown publicly.
This question is for testing whether you are a human visitor and to prevent automated spam submissions.