Skip to content

Instantly share code, notes, and snippets.

@alexpacer
Created December 21, 2017 01:42
Show Gist options
  • Save alexpacer/ef2d4376a7d2b314d478a636138b0a46 to your computer and use it in GitHub Desktop.
Save alexpacer/ef2d4376a7d2b314d478a636138b0a46 to your computer and use it in GitHub Desktop.
Mongodb config server startup script on CentOS: "/etc/rc.d/init.d/mongod-config"
#!/bin/sh
#
# mongodb Startup script for the mongodb _config_ server
#
# chkconfig: - 64 36
# description: MongoDB Database Configuration Server
# processname: mongodb
#Source function library
. /etc/rc.d/init.d/functions
start(){
echo -n $"Starting mongodb....:)"
daemon --user=mongod /usr/bin/mongod "--configsvr -dbpath /data/configdb --port 27019"
}
stop(){
echo -n $"Stopping mongodb.....:("
/usr/bin/mongod --shutdown --dbpath /data/configdb
}
restart(){
/usr/bin/mongod --shutdown --dbpath /data/configdb
daemon --user=mongod /usr/bin/mongod "--configsvr -dbpath /data/configdb --port 27019"
}
case "$1" in
start)
echo "Start service mongod"
start
;;
stop)
echo "Stop service mongod"
stop
;;
restart)
echo "Restart service mongod"
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment