Skip to content

Instantly share code, notes, and snippets.

@hanbei
Created October 12, 2017 12:30
Show Gist options
  • Save hanbei/b2b30d8c5419904093629b61660e366a to your computer and use it in GitHub Desktop.
Save hanbei/b2b30d8c5419904093629b61660e366a to your computer and use it in GitHub Desktop.
MongoDB docker start/stop script
#!/bin/bash
# sudo docker run -d -p 27017:27017 --net static_internal --ip 201.1.1.2 --name mongodb mongo
start() {
sudo docker start mongodb
}
stop() {
sudo docker stop mongodb
}
status() {
sudo docker ps | grep mongodb
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment