I am having trouble setting a service with logging using runit. Here is a brief overview of files and scripts I created according to runit's documentation and other resources I found on the internet:
I am using runit under debian, hence:
/etc/service/test is a symbolic link to
$ ls /etc/sv/test finish log run
$ ls /etc/sv/test/log config run
$ cat /etc/sv/test/run #!/bin/sh touch /tmp/pid echo $$ > /tmp/pid while true; do date sleep 3 done
$ cat /etc/sv/test/finish #!/bin/sh kill `cat /tmp/pid`
cat /etc/sv/test/log/run #!/bin/sh exec svlogd -t /var/log/test
/var/log/test exists, and the service runs.
$ sv s test run: test: (pid 11547) 536s; down: log: 1s, normally up, want up
But the log directory is empty ... What am I missing? Where is all the logging information ?
I also made sure all scripts are executable.
It seems that the
sv fails to start the logging script for some reason!
$ sv s test run: test: (pid 14612) 5s; down: log: 0s, normally up, want up
If you want to stop the logging script you have to issue:
$ sv d test/log
/usr/bin/loggerwith a service-specific tag or directly to some log aggregator's collection agent (to skip the parsing of syslog steps). (Logs are really streams of events but so are often awkwardly serialized from stderr/stdout to files.)