vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Database backup (https://vborg.vbsupport.ru/showthread.php?t=320322)

ravensix 09-22-2015 01:12 PM

Database backup
 
Does anyone know how to do an automatic back up of the database for vB 5?

Dave 09-22-2015 01:20 PM

This doesn't have to be done inside of vBulletin, you can simply setup a cronjob to execute a bash file to run mysqlbackup every X hours/days to make a backup to a certain location.

Then you could even execute a tool such as zip in the bash file to zip the backup and save some storage.

ravensix 09-22-2015 02:43 PM

I have tried this but I dont have permission with this script. I can run just the mysqldump command manually and it works but as soon try to run the backup.sh script with the code below it says I dont have permission. Any ideas on how fix this? Thank you for your help.

#!/user/bin/sh
mysqldump -u root -p pwd --opt db1.sql > /respaldosql/db1.sql

Dave 09-22-2015 03:13 PM

Try chmodding the file to allow execution: chmod u+x file.sh

ravensix 09-22-2015 03:45 PM

I am now getting

-bash: ./backup.sh: /user/bin/sh^M: bad interpreter: No such file or directory
and with out /user
-bash: ./backup.sh: /bin/sh^M: bad interpreter: No such file or directory

--------------- Added [DATE]1442944340[/DATE] at [TIME]1442944340[/TIME] ---------------

Let me give you the actually code that I am using. Maybe this will help.

#!/bin/sh
mysqldump --no-create-db=true --opt -Q -h dbxxxxxxxx.db.1and1.com -u dbxxxxxxxxx -pxxxxxx dbxxxxxxxxxx > files/jaxreef.org`date +%m%d%y%H%M`.sql
find files/jaxreef* -mtime +5 -exec rm {} \;

Dave 09-22-2015 04:59 PM

That happens when you create a new file on Windows, you have to open the backup.sh file in your editor and save it with "Unix" line endings.

Replicant 09-22-2015 05:20 PM

Quote:

Originally Posted by Dave (Post 2555526)
This doesn't have to be done inside of vBulletin, you can simply setup a cronjob to execute a bash file to run mysqlbackup every X hours/days to make a backup to a certain location.

Then you could even execute a tool such as zip in the bash file to zip the backup and save some storage.

This is good advice. The best part is vb5 comes with a bash backup script (vb_backup.sh) in the do_not_upload folder. It automatically backs up the database, names it by dbname-date, and compresses it with gzip. You need to edit the path_to_config variable in the script.

ravensix 09-22-2015 05:33 PM

Dave thank you for the help. It works now. :)

shimei 09-22-2015 05:35 PM

Just in case anyone else is looking for how to do this.... I created a thread:

https://www.christforums.org/forum/e...-code-for-cron


All times are GMT. The time now is 08:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01089 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete