Created
October 12, 2017 12:30
-
-
Save hanbei/b2b30d8c5419904093629b61660e366a to your computer and use it in GitHub Desktop.
MongoDB docker start/stop script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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