2 Supervising the Radiusd Daemon
3 ==============================
8 We all hope that our radius daemons won't die in the middle of the
9 nite stranding customer and beeping beepers. But, alas, it's going to
10 happen, and when you least expect it. That's why you want a another
11 process watching your radius daemon, restarting it if and when it
14 This text describes how to setup both the free radius daemon so that
15 it is automatically restarted if the process quits unexpectedly. To
16 do this, we'll use either Dan Bernstein's 'daemontools' package or the
17 inittab file. Note: The radwatch script that used to be part of this
18 distribution, is depreciated and SHOULD NOT BE USED.
20 Setting Up Daemontools
21 ----------------------
23 First, download (and install) daemontools from:
25 http://cr.yp.to/daemontools.html
27 The latest version as of this writing is 0.70. It would be well worth
28 your while to read all the documentation at that site too, as you can
29 do much more with daemontools than I describe here.
31 Next, we'll need a directory for the radius 'service' to use with
32 daemontools. I usually create a dir '/var/svc' to hold all my
33 daemontool supervised services. i.e.::
36 $ mkdir /var/svc/radiusd
38 Now we just need a short shell script called 'run' in our new service
39 directory that will start our daemon. The following should get you
43 # Save as /var/svc/radiusd/run
44 exec /usr/local/sbin/radiusd -s -f
46 Of course you'll want to make that 'run' file executable::
48 $ chmod +x /var/svc/radiusd/run
50 Note, you *MUST* use the '-f' option when supervising. That option
51 tells radiusd not to detach from the tty when starting. If you don't
52 use that option, the daemontools will always think that radiusd has
53 just died and will (try to) restart it. Not good.
55 Now the only left to do is to start the 'supervise' command that came
56 with daemontools. Do that like so::
58 $ supervise /var/svc/radiusd
60 Maintenance With Daemontools
61 ----------------------------
63 Any maintenance you need to do with almost certainly be done with the
64 'svc' program in the deamontools package. i.e.::
67 $ svc -d /var/svc/radiusd
70 $ svc -u /var/svc/radiusd
73 $ svc -h /var/svc/radiusd
75 Shutdown and stop supervising radiusd:
76 $ svc -dx /var/svc/radiusd
78 Supervising With Inittab
79 ------------------------
81 This is really pretty easy, but it is system dependent. I strongly
82 suggest you read the man pages for your 'init' before playing with
83 this. You can seriously hose your system if you screw up your
86 Add this line (or something similar to it) to your inittab::
88 fr:23:respawn:/usr/local/sbin/radiusd -f -s &> /dev/null
90 Now all that's left is to have the system reread the inittab. Usually
91 that's done with one of the following::
99 Now you should see a 'radiusd' process when you issue a 'ps'. If you
100 don't, try to run the radiusd command you put in inittab manually. If
101 it works, that means you didn't tell the system to reread inittab
102 properly. If it doesn't work, that means your radius start command is
103 bad and you need to fix it.
108 Document author : Jeff Carneal
109 daemontools auther : Dan Bernstein
110 Further daemontool notes (below): Antonio Dias
111 Radwatch note : Andrey Melnikov
113 Further Daemontools notes
114 =========================
116 Here are some notes by Antonia Dias sent to the free radius mailing
117 list. Some of you may find this useful after reading the above and the
118 docs for daemontools.
120 Daemontools Instructions
121 ------------------------
123 I am running radiusd under supervise from daemontools without
124 problems. The only thing I am missing right now is an option to force
125 radiusd to send log to stderr so I can manage logs better with
126 multilog (also included in daemontools package). Here is the procedure
127 I've been following (for Cistron RADIUS)::
132 $ mkdir /etc/radiusd/log
133 $ mkdir /etc/radiusd/log/main
134 $ chmod +t+s /etc/radiusd /etc/radiusd/log
135 $ chown log.log /etc/radiusd/log/main
137 Here are the contents of run files from '/etc/radiusd' and '/etc/radiusd/log'::
143 exec /usr/sbin/radiusd -fyzx
144 $ cd /etc/radiusd/log
147 exec setuidgid log multilog t ./main
149 To make service wake-up do::
151 $ ln -sf /etc/radiusd /service
153 Hang-up (to reload config) it using::
155 $ svc -h /service/radiusd
157 Disable (down) it using::
159 $ svc -d /service/radiusd
161 Reenable (up) it using::
163 $ svc -u /service/radiusd