What to do when the init.d script doesn't help with the job?
At CentOS (5 and 6 at least) to start multi memcached instances cause a lot of trouble, if it was like Ubuntu's init.d script it would be so much elegant.
For that I currently use this:
Copy a few important things first:
cp /etc/init.d/memcached /etc/init.d/memcached-instancename cp /etc/sysconfig/memcached /etc/sysconfig/memcached-instancename
It's important that you change "instancename" with the name you want.
Change a few values:
sed -i 's/sysconfig\/memcached/sysconfig\/memcached-instancename/g' /etc/init.d/memcached-instancename sed -i 's/memcached\/memcached.pid/memcached\/memcached-instancename.pid/g' /etc/init.d/memcached-instancename sed -i 's/subsys\/memcached/subsys\/memcached-instancename/g' /etc/init.d/memcached-instancename sed -i 's/11211/newport/g' /etc/sysconfig/memcached-instancename
It's important that you change the "newport" value to some port available like 11311.
And, again, it's important that you change "instancename" with the name you used above.
And to auto start it:
chkconfig --add memcached-instancename chkconfig memcached-instancename on
Repetition is a must, because it's really important that you change "instancename" for the same name you used above.
Start it happily:
service memcached-instancename start