Skip to content

Instantly share code, notes, and snippets.

@Qooh0
Created October 19, 2014 03:42
Show Gist options
  • Save Qooh0/3af086af942f30c05726 to your computer and use it in GitHub Desktop.
Save Qooh0/3af086af942f30c05726 to your computer and use it in GitHub Desktop.
redis start/stop scripts
#!/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