2015-04-02

Just runit

install runit
- sudo apt-get install runit
- sudo port install runit

On mac:
runsvdir is not started as a service. Use following command to start:
sudo port load runit 
Notice that with ps aux | grep runsvdir, there is a error message shows that /opt/local/var/service folder is not existed and runsvdir is failed.
So need to sudo port unload runit, create service folder and load runit again.

create folder holding aviable service:
sudo mkdir /opt/local/var/service_avaible

create service s1
sudo mkdir /opt/local/var/service_avaible/s1

add run script
cd /opt/local/var/service_avaible/s1
sudo vim run

content should be similar like:
#!/bin/sh
# only write to stdout
exec 2>&1
# run some command

create log:
mkdir log
vim log/run
#!/bin/sh
exec chpst -uUSER svlogd -tt /dir/to/log/folder

make the executable
sudo chmod 700 /opt/local/var/service_avaible/s1/run
sudo chmod 700 /opt/local/var/service_avaible/s1/log/run

enable it by
sudo ln -s /opt/local/var/service{_avaible,}/s1

No comments:

Post a Comment