Skip to content

Instantly share code, notes, and snippets.

@mansurali901
Created March 29, 2019 16:45
Show Gist options
  • Save mansurali901/fa10138c7a844812c5040a4e47f0a702 to your computer and use it in GitHub Desktop.
Save mansurali901/fa10138c7a844812c5040a4e47f0a702 to your computer and use it in GitHub Desktop.
#!/bin/bash
GoMongo () {
echo "Mongo is going to start"
mongod --config /etc/mongod.conf
echo "mongo is started"
}
StopMongo () {
echo "Mongo is going to stop"
mongod --shutdown --config /etc/mongod.conf
echo "mongo is stopped"
}
mongo_func () {
case $arg in
--start)
GoMongo
;;
--stop)
StopMongo
;;
*)
echo "Invalid Parameter please use below parameters
--start This option will start mongo
--stop This option will stop mongo
"
;;
esac
}
arg=$@
if [ $# -le '1' ];
then
echo "Mongo is starting "
mongo_func
else
echo "Invalid number of parameters"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment