@task
def mongodump(ctx, path):
 db = settings.DB_NAME
 port = settings.DB_PORT
 cmd = 'mongodump --db {db} --port {port} --out {path}'.format(db=db, port=port, path=path, pty=True)
 if settings.DB_USER:
  cmd += ' --username {0}'.format(settings.DB_USER)
 if settings.DB_PASS:
  cmd += ' --password {0}'.format(settings.DB_PASS)
 ctx.run(cmd, echo=True)
 print ()
 print 'To restore from the dumped database, run `invoke mongorestore {0}`'.format(os.path.join(path, settings.DB_NAME))

@ task def mongodump ( ctx , path ) : db = settings . DB_NAME port = settings . DB_PORT cmd = 'mongodump --db {db} --port {port} --out {path}' . format ( db = db , port = port , path = path , pty = True ) if settings . DB_USER : cmd += ' --username {0}' . format ( settings . DB_USER ) if settings . DB_PASS : cmd += ' --password {0}' . format ( settings . DB_PASS ) ctx . run ( cmd , echo = True ) print ( ) print 'To restore from the dumped database, run `invoke mongorestore {0}`' . format ( os . path . join ( path , settings . DB_NAME ) )
back up the contents of the running osf database .