About MongoDB's scheduled backups under Linux

Source: Internet
Author: User

Liunx Shell implements a backup of MongoDB

#!/bin/bash#program # this shell  is used for backup of mongodb#history#2014/09/16 11:25           qiushipath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/ Sbin:~/binexport pathtargetpath= '/home/muse68 ' nowtime=$ (date +%y%m%d%h%m) Start () {mongodump -d  wedate -o ${targetpath}/${nowtime} }execute () {startif [ $? -eq 0  ]thenecho  "back successfully" elseecho  "back failure!" fi}if [ ! -d  "${targetpath}/${nowtime}/"  ]thenmkdir  ${targetpath}/${ nowtime}fiexecuteecho  "===========back end ${nowtime}===================" 


Make backups every three minutes using the Linux crontab

# Create crontabcrontab-e# Edit crontab Content */3 * * * * sh above shell# restart Crond/etc/init.d/crond restartservice crond status# detailed content refer to Linux crontab



About MongoDB's scheduled backups under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.