create new plist named: org.mongo.mongod.plist in /Library/LaunchDaemons/
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.mongo.mongod</string> <key>RunAtLoad</key> <true /> <key>ProgramArguments</key> <array> <string>/usr/local/bin/mongod</string> <string>--logpath</string> <string>/var/log/mongodb.log</string> </array> </dict> </plist>
ensure that file mongodb.log already exist or you should create empty file (
touch
/var/log/mongodb
.log or vim /var/log/mongodb.log)
chown root:wheel /Library/LaunchDaemons/org.mongo.mongod.plist
launchctl load
/Library/LaunchDaemons/org
.mongo.mongod.plist
launchctl start org.mongo.mongod
Nhận xét
Đăng nhận xét