From a bash backup script I want to call db.fsyncLock()
, then execute other commands (fs snapshotting) and later db.fsyncUnlock()
non-consecutively over the same connection, since it is advised as best practice.
I tried named pipes, but mongo shell crashes when having something piped via stdin. How can I achieve this?
Was looking for a solution to the same problem and found this short article http://www.kamsky.org/stupid-tricks-with-mongodb/backups-and-locking that offer a solution using a script to run inside mongo that during the lock launch a bash command that perform the backup.