This is really more of a CentOS question than a Ruby question, but you want
an init script.

http://www.justinbritten.com/work/2009/05/god-initd-script-for-centos/

-Steve