برگزیده های پرشین تولز

آموزش بک آبگیری خودکار از ویبولتین

SatCo

کاربر تازه وارد
تاریخ عضویت
11 می 2007
نوشته‌ها
16
لایک‌ها
0
سلام اگر کسی بلده اموزش بک آبگیری خودکار از وی بولتین رو به من بگه میخواهم تمامی فایلها کل دیتابیس و غیره بک اب بگیره در کل یک فول بک اب باشه ;)

البته راه های زیادی هست اما خواهشا بک آبگیری از طریق شل رو دوستان اموزش بدن بهتره
 

Domain

Registered User
تاریخ عضویت
9 می 2007
نوشته‌ها
1,698
لایک‌ها
2
محل سکونت
f34.html ♪♫♪

iranexplorer.net

کاربر قدیمی پرشین تولز
کاربر قدیمی پرشین تولز
تاریخ عضویت
20 دسامبر 2003
نوشته‌ها
2,896
لایک‌ها
2,151
توضیحات رو اینجا قرار دادم راحت تر بخونید:

To automatically make a backup of your database using *nix cron:

Requires: Shell access, ability to run bash and add (hah) scripts to cron.xxx.

کد:
#! /bin/bash
# Automated database datestamp backup

mysqldump --opt -Q -u dbusername -pPassword dbname > /path/to/backups/`date --iso-8601`.sql

Open it up, replace:

  • dbusername
  • Password
  • dbname

With the proper information. Note that there is no space between -pPassword, it's intentional.

Then replace "/path/to/backups/" with the actual path that you want to put them in. Make sure the directory exists.

Put the backup.sh file in the appropriate cron folder. I'm running mine weekly, so mine is in /etc/cron.weekly/. CHMOD it +x (chmod +x backup.sh)

Output of it is a database file, named (the date).sql.

Putting it in cron.weekly will run it every Sunday night at Midnight, and give you a file that looks like this:

کد:
[cron.weekly]# sh backup.sh
[cron.weekly]# ls /home/backups/
2006-01-13.sql
[cron.weekly]#

Note: If you don't have access to /etc on your webserver, but have a crontab for your account at your host, you should use the absolute directory path and save it to a location within your host.

An example would be: /var/www/vhosts/yourdomain.tld/httpdocs/backups

Ideally this would work well in conjunction with a script on a local box (assuming your site is hosted remotely) that could shell in and download the backups automatically as well. I'll try and update this with exact instructions on how to do that if I can.

Information on automating the SSH transfer process in general can be found here and is pretty thorough, but I haven't tested it yet.

Combining multiple backups into one single cron script:

If your other databases are all accessible from the same shell prompt and user, you can do this one of two ways. If whatever user you're using for cron has permission to run mysqldump, you can:

Put them all in different folders with the same name, like so. Make sure the target folder exists, it might bark at you if it doesn't. Basically just run the dump command however many times you need to run it, with the respective names/passwords on each line.

I put in a sleep 5 just to give a small pause between operations. All it does is tell the OS to pause for 5 seconds before running the next command. It's probably not necessary, but MySQL might become unhappy if you run one command directly after another - it just gives your CPU/Memory a chance to cycle if necessary.

کد:
#! /bin/bash
# Automated database datestamp backup

mysqldump --opt -Q -u dbusername1 -pPassword1 dbname1 > /path/to/backups/1/`date --iso-8601`.sql 
sleep 5
mysqldump --opt -Q -u dbusername2 -pPassword2 dbname2 > /path/to/backups/2/`date --iso-8601`.sql 
sleep 5
mysqldump --opt -Q -u dbusername2 -pPassword3 dbname3 > /path/to/backups/3/`date --iso-8601`.sql

Or, you can put them all in the same directory with tags in front of each to name them, like this. I'm just putting databasename_ in front of each as an example, you can put whatever you want in front of the `date text.

کد:
#! /bin/bash
# Automated database datestamp backup

mysqldump --opt -Q -u dbusername1 -pPassword1 dbname1 > /path/to/backups/vbulletin_`date --iso-8601`.sql 
sleep 5
mysqldump --opt -Q -u dbusername2 -pPassword2 dbname2 > /path/to/backups/wiki_`date --iso-8601`.sql 
sleep 5
mysqldump --opt -Q -u dbusername2 -pPassword3 dbname3 > /path/to/backups/photopost_`date --iso-8601`.sql

So if you're only allowed one cron job, just stack as many commands into it as you need.​
 

SatCo

کاربر تازه وارد
تاریخ عضویت
11 می 2007
نوشته‌ها
16
لایک‌ها
0
سپاسگذارم

ببخشید در این صورت آخه من فایلهای ضمیمه خودم رو از دیتا بیس منتقل کردم بر روی هاست آیا با این روش اون فایلهای ضمیمه من که 777 تبدیل کردم رو هم در بر میگیرد

در ضمن اگر کمی توضیح فارسی بدید ممنون میشود چطوری بک اب گرفت و ریستور کرد!!

لیسانس داریم;)
 
بالا