Jump to content
  • 0

Automated Database Backups


Linkin Park

Question


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

How to setup a cron job that will automate database backup every 3am and make it upload the backup file to a separate ftp server?

Using CentOS.

Edited by RaGERO
Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  292
  • Reputation:   17
  • Joined:  12/12/11
  • Last Seen:  

There's a script from calciumkid that's posted in eathena.. :)

The sad news is, eathena is down now..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

bump... :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  218
  • Reputation:   16
  • Joined:  01/24/12
  • Last Seen:  


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  707
  • Reputation:   168
  • Joined:  01/26/12
  • Last Seen:  

Hi RaGERO,

You can use this script;

https://asurahosting...ols/bkup_sql.sh

Just modify the values correctly, and make sure the backup directory you are saving it to... actually exists.

To make a folder, you can use VNC or type the following command in the terminal...

mkdir /DESTINATION/NEW_FOLDER

To make the script executable, you can edit the properties in your SFTP client or do the following command in the terminal...

cd /LOCATION/OF/SCRIPT
chmod +x bkup_sql.sh

Then finally, you need to add it to the cronjob; which would be like this...

export EDITOR=/usr/bin/nano
crontab -e

Inside the crontab, you would need to input...

0 3 * * * /LOCATION/OF/SCRIPT/bkup_sql.sh

Then just ctrl + c and save.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  382
  • Reputation:   38
  • Joined:  01/17/12
  • Last Seen:  

Inside the crontab, you would need to input...

0 3 0 0 0 /LOCATION/OF/SCRIPT/bkup_sql.sh

This gave me an error. Fixed it by using * instead of 0:

0 3 * * * /LOCATION/OF/SCRIPT/bkup_sql.sh

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

@Asura,

This will only save the backups on the specified directory, I want it to be uploaded on a separate ftp server.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  292
  • Reputation:   17
  • Joined:  12/12/11
  • Last Seen:  

@Asura,

This will only save the backups on the specified directory, I want it to be uploaded on a separate ftp server.

Use Eden's post.. :) that's what I'm telling you about.... :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  707
  • Reputation:   168
  • Joined:  01/26/12
  • Last Seen:  

This gave me an error. Fixed it by using * instead of 0:

0 3 * * * /LOCATION/OF/SCRIPT/bkup_sql.sh

Hi Bahmut,

You're right; my mistake. Thanks for the correction.

@Asura,

This will only save the backups on the specified directory, I want it to be uploaded on a separate ftp server.

Hi RaGERO,

If your backup server allows SSH access, you can install the cron task on there and just add the variable '-h'.

mysqldump -h 123.123.123.123 -u USERNAME -p, --password=PASSWORD DATABASE_NAME > FILE_NAME.sql

Replace the 123.123.123.123 with the correct MySQL Host IP; and all the capital letters with the correct information.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   1
  • Joined:  12/17/11
  • Last Seen:  

Windows version?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  02/10/12
  • Last Seen:  

Automatic backups are best done with software like swordsky has really good software with really good options that allows you to back up really large databases and it works as a windows service.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   1
  • Joined:  12/17/11
  • Last Seen:  

Automatic backups are best done with software like swordsky has really good software with really good options that allows you to back up really large databases and it works as a windows service.

Thanks, I like to use windows because many korean game use it with mssql.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...