Skip to content

Instantly share code, notes, and snippets.

@matetsu
Created December 28, 2012 03:47
Show Gist options
  • Save matetsu/4394271 to your computer and use it in GitHub Desktop.
Save matetsu/4394271 to your computer and use it in GitHub Desktop.
Redisフェイルオーバ時に実行するスクリプト。 要redis-vpc-route-change.py
#!/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