#!/bin/bash # #chkconfig: 2345 80 90 #description: mongodb start() { /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/mongo_data --logpath=/usr/local/mongodb/logs/mongodb.log --logappend --fork } stop() { /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/mongo_data --logpath=/usr/local/mongodb/logs/mongodb.log --logappend --fork --shutdown } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac
chmod +x /etc/rc.d/init.d/mongodb chkconfig --add mongodb chkconfig --level 345 mongodb on chkconfig --list mongodb
时间: 2024-10-29 19:05:50