Best practice to tail a log and start it as service using rc.d scripts

Matthias Fechner idefix at fechner.net
Mon Jul 3 16:20:41 UTC 2017


Dear all,

I just in the process to test mailtrain (https://mailtrain.org/) and if
it is working I would like to create a port for FreeBSD.

That mailtrain can handle bounce message with postfix together it is
necessary to tail the postfix log and pass it to mailtrain, using a
command like this:
tail -F -n +0 /var/log/maillog | nc localhost 5699 -

Is there a best practice approach on how to do this on FreeBSD?
I would require now a startup script in /usr/local/etc/rc.d to start
this kind of tail or is there a better mechanism in FreeBSD available?
If not, does anyone have some kind of template/example on how to start a
program like tail as daemon so FreeBSD can stop/restart it with the
service command?

Thanks
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook




More information about the freebsd-ports mailing list