5.4. Using restartWrapper Previous topic Parent topic Child topic Next topic

In a Unix environment, you can arrange for radiusd to be restarted automatically if it exits unexpectedly by using the restartWrapper script. restartWrapper is included in the goodies/ directory of the Radiator distribution. It is not installed automatically, so if you want to use it, you will probably want to copy it to your local binaries directory. Radiator must be run in the foreground with the Foreground parameter or the -foreground argument. For more information, see Section 3.7.1. Foreground.
restartWrapper never terminates, so you will probably want to run it in the background with an ampersand (&), especially if you are calling it from a system boot script.
You will probably want to put a call to restartWrapper in your Unix system boot script so that radiusd is started automatically at boot time by restartWrapper. This will usually involve modifying /etc/rc.local or adding a new script to /etc/rc2.d, depending on what type of Unix you are running. See your system documentation for more details about system start-up scripts.
The arguments are:
restartWrapper [-h] [-delay n] [-mail address] 
      [-min_interval n (default: 0)]
      [-sendmail path-to-sendmail] 
      [-syslog facility.level (default: user.err)]
      [-logger path-to-logger (default: /usr/bin/logger)]
      "command to run"
  • -h
    Print usage help message.
  • -delay n
    Number of seconds to wait before restarting the command. Defaults to 10 seconds.
  • -min_interval n
    Minimum interval in seconds between successive restart. Defaults to 0 seconds.
  • -mail address
    The email address to send a message to when the command exits. By default, no email is sent.
  • -sendmail path-to-sendmail
    Specifies an alternate path to the sendmail program which will be used to send email if the -mail argument is specified. Defaults to /usr/lib/sendmail.
  • -syslog facility.level
    Specifies an optional syslog facility and level to be used to log messages using syslog. If this is not specified, syslog will not be used to log messages.
  • -logger path-to-logger
    Specifies the syslog logger program which will be used to log syslog messages. Defaults to /usr/bin/logger.
  • "command to run"
    This is the complete command that is to be run, including arguments if any. You should enclose the entire command in double quotes, especially if the command contains arguments that might be mistaken for arguments to restartWrapper. You will probably want to specify the full path to the command.

Example

Run radiusd with a specified config file. If it stops, send email to mikem@open.com.au and wait 2 seconds before restarting it.
restartWrapper -mail mikem@open.com.au -delay 2 \
      "/bin/radiusd -config_file /etc/radius.cfg \
      -foreground" &
Tip
Make sure that Radiator is running in “foreground” mode, either with -foreground in the command line arguments, or with Foreground the configuration file.
Tip
If you are starting restartWrapper from inside a Unix startup script, you will need to follow the command line with an ampersand (&), otherwise the unix startup script will never complete.