Created
December 28, 2012 03:47
-
-
Save matetsu/4394271 to your computer and use it in GitHub Desktop.
Redisフェイルオーバ時に実行するスクリプト。
要redis-vpc-route-change.py
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/sh | |
IPADDR=`LANG=C ifconfig eth0 | sed -n '/.*inet addr:\([0-9.]*\).*/{s//\1/;p}'` | |
LOCK_FILE="/tmp/redis-failover.lock" | |
if [ "$#" = "7" ]; then | |
if [ ! -f ${LOCK_FILE} ]; then | |
touch ${LOCK_FILE} | |
if [ "$3" = "end" -a $6 = ${IPADDR} ]; then | |
/usr/bin/python /usr/local/sbin/redis-vpc-route-change.py | |
fi | |
if [ -f ${LOCK_FILE} ]; then | |
rm -f ${LOCK_FILE} | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment