Koozali.org: home of the SME Server

Legacy Forums => General Discussion (Legacy) => Topic started by: Rien on July 31, 2005, 12:39:33 AM

Title: Daily backup databases
Post by: Rien on July 31, 2005, 12:39:33 AM
I want to make a backup of several databases on a daily basis.

I use te command:
Code: [Select]
mysqldump --add-drop-table --databases DB1 DB2 > /backup/directory/backup.sql

Is there a way to insert the date/time in the name of the backup file?
Title: Daily backup databases
Post by: ergozd on July 31, 2005, 07:47:28 AM
You could try creating a cron file with
Code: [Select]

#!/bin/sh
date=date -I
mysqldump --add-drop-table --databases DB1 DB2 > /backup/directory/$date-backup.sql
Title: Daily backup databases
Post by: Rien on July 31, 2005, 02:25:02 PM
Thanks, that did the trick.
Do you know how I can remove the "?" at the end of the datestring?
Title: Daily backup databases
Post by: ergozd on July 31, 2005, 02:52:23 PM
Hi!

Not really sure with "?" at the end of datestring...

Code: [Select]
[root@XXXXXX]# date -I
2005-07-31


Check your script so you don't have a typo...

Your backup file should have the name
Code: [Select]
2005-07-31-backup.sql
Title: Daily backup databases
Post by: Rien on July 31, 2005, 04:05:58 PM
Hi,

The code:
Code: [Select]
[root@XXXXXX]# date -I
2005-07-31


works fine but when I put that in the script is displays:

Code: [Select]
2005-07-31?-backup.sql

My script is:

Code: [Select]
date=date -I
mysqldump --add-drop-table --databases home fczc4 > /home/e-smith/files/ibays/software/files/backup/$date-backup.sql


Strange isn't it?
Title: Daily backup databases
Post by: ergozd on July 31, 2005, 04:17:59 PM
Try this one... You can modify the date format as you wanted by simply modifying parameters for day, month and year

Code: [Select]
#!/bin/bash
DATE=date +%d-%m-%y
mysqldump --add-drop-table DBNAME > backup-$DATE.sql
gzip --best backup-$DATE.sql


Output should be
Code: [Select]
backup-31-07-05.sql.gz
Title: Daily backup databases
Post by: Rien on July 31, 2005, 06:46:03 PM
Hi,

I tried that but I get the same "?" after the date in the filename.
Can it be I have an old version. I use version 2.0.11 (sh-utils) which is part of SME-server 6.0.1-1.
Title: Daily backup databases
Post by: ergozd on July 31, 2005, 07:55:53 PM
That was intreseting...  :-?
I have NO idea why you get "?"...

PS: It's not because of sh-utils, I have the same version.
Title: Daily backup databases
Post by: Rien on July 31, 2005, 11:20:21 PM
I tried different options now but without success.
Title: Daily backup databases
Post by: cosy on September 11, 2005, 09:41:21 AM
Hi All,

  I want to Backup some of MYSQL DB's in SME 6.X Server. Is their any GUI interface for backup?

Can i connect any windows mysql backup software to backup these db's if so how?

Thanks
Title: Daily backup databases
Post by: Rien on September 11, 2005, 10:08:51 AM
Hi Cosy,

I use "PHPMyAdmin" to make backups. You can select DB's and tables and export them.
Title: Daily backup databases
Post by: arthurhanlon on September 11, 2005, 01:31:59 PM
Hi there,

The is a handy web based DB backup utility at http://www.phpmybackuppro.net/. I use this on other servers and it works great. Haven't tried it on SME yet though.

Arthur
Title: Daily backup databases
Post by: cosy on September 20, 2005, 06:42:18 AM
Hi,

 Can you install into SME and tell me the steps pls
Title: Daily backup databases
Post by: arthurhanlon on September 20, 2005, 09:31:51 PM
Hi,

Never installed onto SME before but I'll give it a try and get back to you. Meanwhile, the help file included is pretty straight forward if you wann have a go yourself.

Arthur
Title: Daily backup databases
Post by: duncan on September 21, 2005, 09:30:04 AM
Hi.

It has been mentioned before - automysqlbackup. (http://sourceforge.net/projects/automysqlbackup/)

Very simple data base backup utility - that works well.