In MongoDB I'm attempting to set up an automated backup of all of the databases that Mongo is holding, my current script base is something along the lines of
mongodump -u username -p password -o backup/(date)
Where i have (date) I'm looking to have it be dumped into a folder with the date of the backup e.g. 2013-02-06
I'm wanting this to happen either through a chron job or a .sh script.
If this is a *nix shell script you could write:
mongodump -u _username_ -p _password_ -o backup/$(date +%Y-%m-%d)
or alternately:
#!/bin/bash
DT=$(/bin/date +%Y-%m-%d)
mongodump -u _username_ -p _password_ -o backup/$DT
this will create a directory YYYY-MM-DD under backup. You'd then likely want to tar the directory up using something like:
tar -czf mongod-backup-$DT.tar backup/$DT