Skip to content

Instantly share code, notes, and snippets.

@yantonov
Created July 24, 2013 01:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yantonov/6067550 to your computer and use it in GitHub Desktop.
Save yantonov/6067550 to your computer and use it in GitHub Desktop.
mongod start script
#/bin/bash
function start {
$MONGODB_HOME/bin/mongod --config=$MONGODB_HOME/bin/mongo.conf
}
case $1 in
start)
start
;;
daemon)
pid=`pidof mongod`
if [ -n "$pid" ]; then
echo "mongod already running"
else
nohup `start` > output.out 2>error.err </dev/null &
echo "`pidof mongod` mongod started"
fi
;;
stop)
pid=`pidof mongod`
if [ -n "$pid" ]; then
kill -9 $pid
echo "$pid mondod stopped"
else
echo "no mongod instances"
fi
;;
*)
echo "Usage: $0 {start|daemon|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment