Reputation: 63
I was wondering how can I create a cron task that can run a command on a mongoshell connection.
Basically I would like to be able to connect to the mongoshell once a month an run a specific command.
The version of mongodb that I'm running is MongoDB shell version: 2.0.7
Thanks
Upvotes: 0
Views: 426
Reputation: 59476
You can create a simple cronjob like this:
0 0 1 * * /usr/bin/mongosh "mongodb://user:pass@localhost/?authSource=admin" --quiet --eval "... your command"
Upvotes: 1