Upstart setting for Redis on ubuntu

這邊記錄安裝Redis的過程

在ubuntu安裝Reids蠻簡單的

sudo apt-get install redis-server

但裝完後,我還想把它改成用upstart的方式啓動

先把原來的啓動模式取消,停掉預設的init.d script

sudo update-rc.d redis-server disable

/etc/redis/redis.conf

daemonize no

建立upstart的啓動script
/etc/init/redis-server.conf

description "redis server"

start on runlevel [23]
stop on shutdown

exec sudo -u redis /usr/bin/redis-server /etc/redis/redis.conf

respawn

再來就可以用upstart啟動了

sudo start redis-server
sudo restart redis-server
sudo stop redis-server
comments powered by Disqus