2 Supervising the Radiusd Daemon
6 We all hope that our radius daemons won't die in the middle of the
7 nite stranding customer and beeping beepers. But, alas, it's going
8 to happen, and when you least expect it. That's why you want a
9 another process watching your radius daemon, restarting it if and
12 This text describes how to setup both the free radius daemon so that
13 it is automatically restarted upon death. To do this, we'll use
14 either Dan Bernstein's 'daemontools' package or the inittab file.
16 Note: The radwatch script that used to be part of this distribution,
17 is depreciated and SHOULD NOT BE USED.
19 1. SETTING UP DAEMONTOOLS
21 First, download (and install) daemontools from:
23 http://cr.yp.to/daemontools.html
25 The latest version as of this writing is 0.70. It would be well
26 worth your while to read all the documentation at that site too,
27 as you can do much more with daemontools than I describe here.
29 Next, we'll need a directory for the radius 'service' to use with
30 daemontools. I usually create a dir '/var/svc' to hold all my
31 daemontool supervised services. Ie:
34 # mkdir /var/svc/radiusd
36 Now we just need a short shell script called 'run' in our new
37 service directory that will start our daemon. The following should
43 exec /usr/local/sbin/radiusd -s -f
45 Of course you'll want to make that 'run' file executable:
47 # chmod +x /var/svc/radiusd/run
49 Note, you *MUST* use the '-f' option when supervising. That option
50 tells radiusd not to detach from the tty when starting. If you don't
51 use that option, the daemontools will always think that radiusd has
52 just died and will (try to) restart it. Not good.
54 Now the only left to do is to start the 'supervise' command that
55 came with daemontools. Do that like so:
57 # supervise /var/svc/radiusd
59 2. MAINTENANCE WITH DAEMONTOOLS
61 Any maintenance you need to do with almost certainly be done with the
62 'svc' program in the deamontools package. Ie:
65 # svc -d /var/svc/radiusd
68 # svc -u /var/svc/radiusd
71 # svc -h /var/svc/radiusd
73 Shutdown and stop supervising radiusd:
74 # svc -dx /var/svc/radiusd
76 3. SUPERVISING WITH INITTAB
78 This is really pretty easy, but it is system dependent. I strongly
79 suggest you read the man pages for your 'init' before playing with
80 this. You can seriously hose your system if you screw up your
83 Add this line (or something similar to it) to your inittab:
85 fr:23:respawn:/usr/local/sbin/radiusd -f -s &> /dev/null
87 Now all that's left is to have the system reread the inittab. Usually
88 that's done with one of the following:
94 Now you should see a 'radiusd' process when you issue a 'ps'. If you
95 don't, try to run the radiusd command you put in inittab manually.
96 If it works, that means you didn't tell the system to reread inittab
97 properly. If it doesn't work, that means your radius start command
98 is bad and you need to fix it.
102 Document author: Jeff Carneal
103 daemontools auther: Dan Bernstein
104 Further daemontool notes (below): Antonio Dias
105 Radwatch note: Andrey Melnikov
107 5. FURTHER DAEMONTOOLS NOTES
109 Here are some notes by Antonia Dias sent to the free radius mailing list.
110 Some of you may find this useful after reading the above and the docs for
113 -------------------------------------------------------------------------
115 daemontools instructions
117 I am running radiusd under supervise from daemontools without problems.
118 The only thing I am missing right now is an option to force radiusd to
119 send log to stderr so I can manage logs better with multilog (also
120 included in daemontools package). Here is the procedure I've been
121 following (for Cistron RADIUS):
123 root@storm:~> groupadd log
124 root@storm:~> useradd -g log log
125 root@storm:~> mkdir /etc/radiusd
126 root@storm:~> mkdir /etc/radiusd/log
127 root@storm:~> mkdir /etc/radiusd/log/main
128 root@storm:~> chmod +t+s /etc/radiusd /etc/radiusd/log
129 root@storm:~> chown log.log /etc/radiusd/log/main
131 Here are the contents of run files from /etc/radiusd and /etc/radiusd/log
133 root@storm:~> cd /etc/radiusd
134 root@storm:/etc/radiusd> cat run
137 exec /usr/sbin/radiusd -fyzx
138 root@storm:/etc/radiusd> cd /etc/radiusd/log
139 root@storm:/etc/radiusd/log> cat run
141 exec setuidgid log multilog t ./main
143 To make service wake-up do:
144 root@storm:~> ln -sf /etc/radiusd /service
146 Hang-up (to reload config) it using:
147 root@storm:~> svc -h /service/radiusd
149 Disable (down) it using:
150 root@storm:~> svc -d /service/radiusd
152 Reenable (up) it using:
153 root@storm:~> svc -u /service/radiusd