Skip to content

Instantly share code, notes, and snippets.

@aminamid
Created May 11, 2015 06:30
Show Gist options
  • Save aminamid/9c603918d6ad59796906 to your computer and use it in GitHub Desktop.
Save aminamid/9c603918d6ad59796906 to your computer and use it in GitHub Desktop.
mongo backup
#!/bin/bash -x
cat <(ls -d /root/mongo_dump_*|sort -u) <(join <(ls -d /root/mongo_dump_*|tail -n10|sort -u) <(ls -d /root/mongo_dump_*|sort -u)) |sort| uniq -u | xargs --no-run-if-empty rm -rf
/bin/bash -l -c 'mongodump --host jpn-zaq40.openwave.com --port 27017 --out ~/mongo_dump_`date "+%Y%m%d%H%M%S"` 2>&1 | logger -t mongodump -p local0.info '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment