Created
October 19, 2014 03:42
-
-
Save Qooh0/3af086af942f30c05726 to your computer and use it in GitHub Desktop.
redis start/stop scripts
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/env bash | |
if [ $# -ne 1 ]; then | |
echo '引数はひとつ' | |
exit | |
fi | |
ARG=$1 | |
start() { | |
pong=$(redis-cli ping 2>/dev/null ) | |
if [ $pong == 'PONG' ]; then | |
echo 'redis is already running' | |
exit | |
fi | |
echo redis-server | |
} | |
stop() { | |
redis-cli shutdown | |
} | |
case $ARG in | |
'start'|'') start;; | |
'stop');; | |
* ) echo "Usage $0 {start|stop}"; exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment