MongoDBの起動、停止スクリプトのサンプルコード

1.start_mongodb.sh
#!/bin/bash
/usr/local/mongodb/bin/mongod –dbpath=/usr/local/mongodb/data –logpath=/usr/local/mongodb/logs –logappend –port=27017 –fork
echo 'mongodb started!’

2. stop_mongodb.sh
#!/bin/bash
/usr/local/mongodb/bin/mongod –shutdown –dbpath /usr/local/mongodb/data/
echo 'mongodb stoped’

3.権限を与える

#chmod +x start_mongodb.sh stop_mongodb.sh

DataBase

Posted by arkgame