memcached自動起動用のプログラム@Cent OS 5.5

$ vi /etc/init.d/memcached

#! /bin/sh
# chkconfig: - 80 12
# description: Memcached

if [ $# -ne 1 ]; then
echo "[start / stop]"
exit 1
fi

case $1 in
start)
/usr/local/bin/memcached -p 11211 -m 64m -u yuki -d
ps axuw | grep "/usr/local/bin/memcached" | grep -v grep
;;
stop)
#/usr/local/bin/memcached stop
kill -9 `ps auxw | grep /usr/local/bin/memcached | egrep -v grep | egrep -v rotatelogs2 | awk '{print $2}'`
;;
*)
echo "[start / stop]"
exit 1
;;
esac

$ chmod 755 /etc/init.d/memcached on
$ chkconfig memcached on