Skip to content

Instantly share code, notes, and snippets.

@taka3110
Last active December 12, 2015 10:39
Show Gist options
  • Save taka3110/4760825 to your computer and use it in GitHub Desktop.
Save taka3110/4760825 to your computer and use it in GitHub Desktop.
開発環境を分けた時のmemcacheをコントロールするスクリプト
#!/bin/sh
PNAME=memcached
PPORT=11211
case $1 in
start) sudo /etc/init.d/$PNAME start ;;
stop) sudo /etc/init.d/$PNAME stop ;;
restart) sudo /etc/init.d/$PNAME restart ;;
stats)
sudo echo "sleep 1;echo stats" > /tmp/$PNAME.sh
sudo sh /tmp/$PNAME.sh | telnet localhost $PPORT
rm -f /tmp/$PNAME.sh
;;
clear)
sudo echo "sleep 1;echo flush_all" > /tmp/$PNAME.sh
sudo sh /tmp/$PNAME.sh | telnet localhost $PPORT
rm -f /tmp/$PNAME.sh
;;
*)
echo "Usage: $N {start|stop|restart|stats|clear}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment