run a program more than once using the rc mechanism, "officially" :)

Hello everybody,

I had a peculiar configuration on one of my servers that needed two different instances of vsftpd to be running on the same jail simultaneously. In order to be able to include the second instance on my /etc/rc.conf, I had to copy /usr/local/etc/rc.d/vsftpd to /usr/local/etc/rc.d/vsftpd2, change each instance of vsftpd into vsftpd2 on the new file, copy /usr/local/libexec/vsftpd to /usr/local/libexec/vsftpd2, and finally include a similar entry for vsftpd2 in /etc/rc.conf :).

Ok, this was not that bad, now I am able to run two different instances of vsftpd on my jail "legally". Of course, when any of the above resources changes in some future release of vsftpd, I will have to remember all that and make the relevant changes again (for example, on each future update, I'll have to remember to re-copy /usr/local/libexec/vsftpd on the corresponding location).

If that was not all, I wanted to be able to see those instances from outside this host, so I had to run two simultaneous instances of ftp-proxy in order to redirect incoming requests on the right machine. Because I didn't want to mess with my base system, I did not perform the above actions on /etc/rc.d/ftp-proxy, and concluded my work by using /etc/rc.local this time (which I could have done also for vsftpd).

Hence my question: Is there an "official"/"legal" way of running more than one instances of a program that is handled by the rc.subr mechanism on FreeBSD?

Thanks in advance.

mamalos
 
Thanx phoenix, I'll look at it.

From what I understand, though, it seems that I'll have to tweak the RC script of the program I wish to run more than once; there doesn't seem to exist a generic way that I can use instead (through /etc/rc.conf). It would be interested if something like that existed...

Thanx again!
 
If the RC script for the port doesn't support it (like openvpn), then no, there's no "generic" way to run a daemon more than once via the RC system.
 
I'm not sure if this is the right answer for your issue. Though it may be related. I understand daemontools (Bernstein) is a tool to confirm that a process will always be up even after it is killed. I can't comment if it has the ability to run the same service more than once. Here is a link:

http://cr.yp.to/daemontools.html
 
Back
Top