Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
  #1  
Old 09-22-2015, 01:12 PM
ravensix ravensix is offline
 
Join Date: May 2015
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Database backup

Does anyone know how to do an automatic back up of the database for vB 5?
Reply With Quote
  #2  
Old 09-22-2015, 01:20 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
Lynne
  #3  
Old 09-22-2015, 02:43 PM
ravensix ravensix is offline
 
Join Date: May 2015
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 09-22-2015, 03:13 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try chmodding the file to allow execution: chmod u+x file.sh
Reply With Quote
  #5  
Old 09-22-2015, 03:45 PM
ravensix ravensix is offline
 
Join Date: May 2015
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 {} \;
Reply With Quote
  #6  
Old 09-22-2015, 04:59 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 09-22-2015, 05:20 PM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave View Post
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.
Reply With Quote
2 благодарности(ей) от:
Lynne, ravensix
  #8  
Old 09-22-2015, 05:33 PM
ravensix ravensix is offline
 
Join Date: May 2015
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dave thank you for the help. It works now.
Reply With Quote
  #9  
Old 09-22-2015, 05:35 PM
shimei shimei is offline
 
Join Date: Feb 2015
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Благодарность от:
Lynne
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:53 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07439 seconds
  • Memory Usage 2,238KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (4)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete