Announcement

Collapse
No announcement yet.

freeradius init.d script

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • kubicle
    replied
    Originally posted by TheBigAmbulance View Post
    I'll have to look at the init logging options as I don't remember right off hand where that is. When the init items come scrolling by on bootup, I see that the freeradius daemon fails. Any advice on the init logging? Is that in syslog/messages/something I have to turn on?

    I got around this for now by adding '/etc/init.d/freeradius start' in /etc/rc.local and it does work. This sorta prooves that freeradius is starting before other services are given a chance to finish starting.
    I concur with your conclusion.

    Since you found a workaround, there is not really a need to dig deeper, but if you're interested you could check /var/log/freeradius/* to see if the programs own logging system has catched errors.

    If you wish to log the results of the init script, you could add something like "exec > /var/log/my_freeradius.log 2>&1" below the shebang (#!/bin/sh) in /etc/init.d/freeradius (this should output stdout and stderr of the init script into /var/log/my_freeradius.log that you could check after booting).

    You can also enable bootlogging in /etc/default/bootlogd, but you might not get much out of it (it's been sort of iffy for years)

    Leave a comment:


  • TheBigAmbulance
    replied
    I'll have to look at the init logging options as I don't remember right off hand where that is. When the init items come scrolling by on bootup, I see that the freeradius daemon fails. Any advice on the init logging? Is that in syslog/messages/something I have to turn on?

    I got around this for now by adding '/etc/init.d/freeradius start' in /etc/rc.local and it does work. This sorta prooves that freeradius is starting before other services are given a chance to finish starting.

    Leave a comment:


  • kubicle
    replied
    Originally posted by TheBigAmbulance View Post
    @kubicle: I tried entering 'update-rc.d freeradius defaults 99 20', but got this...
    Code:
    root@aaa:/# update-rc.d freeradius defaults 99 20
     System start/stop links for /etc/init.d/freeradius already exist.
    root@aaa:/#
    That's because the previous command already created the links...james posted his suggestion while I was typing mine (so my command was somewhat redundant).

    The mysql dependency problem sounds plausible, of course you could log the output of the init script during boot to see if it outputs any errors of interest (it could confirm whether the script runs and whether the problem is indeed a mysql error)

    Leave a comment:


  • TheBigAmbulance
    replied
    Hmmm... I am using mysql

    https://bugs.launchpad.net/ubuntu/+s...s/+bug/1081509

    Leave a comment:


  • TheBigAmbulance
    replied
    Thanks for the feedback!!

    @Snowhog: The file is executable.
    Code:
    root@aaa:/# ls -la /etc/init.d/freeradius
    -rwxr-xr-x 1 root root 2165 Dec 10 16:09 /etc/init.d/freeradius
    root@aaa:/#
    @james147: Your command had this to say:
    Code:
    root@aaa:/# update-rc.d freeradius enable
    update-rc.d: warning: freeradius start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
    update-rc.d: warning: freeradius stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
     Enabling system startup links for /etc/init.d/freeradius ...
     Removing any system startup links for /etc/init.d/freeradius ...
       /etc/rc2.d/S99freeradius
       /etc/rc3.d/S99freeradius
       /etc/rc5.d/S99freeradius
     Adding system startup for /etc/init.d/freeradius ...
       /etc/rc2.d/S99freeradius -> ../init.d/freeradius
       /etc/rc3.d/S99freeradius -> ../init.d/freeradius
       /etc/rc5.d/S99freeradius -> ../init.d/freeradius
    root@aaa:/#
    @kubicle: I tried entering 'update-rc.d freeradius defaults 99 20', but got this...
    Code:
    root@aaa:/# update-rc.d freeradius defaults 99 20
     System start/stop links for /etc/init.d/freeradius already exist.
    root@aaa:/#
    When the system has a fresh boot, freeradius doesn't start but all the init statements work:

    Code:
    root@aaa:/# start freeradius
    start: Unknown job: freeradius
    root@aaa:/# service freeradius start
     * Starting FreeRADIUS daemon freeradius                                                                                                              [ OK ] 
    root@aaa:/# netstat -lnp | grep radius
    udp        0      0 0.0.0.0:1812            0.0.0.0:*                           2189/freeradius 
    udp        0      0 0.0.0.0:1813            0.0.0.0:*                           2189/freeradius 
    udp        0      0 0.0.0.0:1814            0.0.0.0:*                           2189/freeradius 
    root@aaa:/# service freeradius stop
     * Stopping FreeRADIUS daemon freeradius                                                                                                              [ OK ] 
    root@aaa:/# netstat -lnp | grep radius
    root@aaa:/#
    The only other reason I could think that it wouldn't start is that some dependencies (ie mysql) did not start by the time freeradius got there? guess....
    Last edited by TheBigAmbulance; Dec 11, 2012, 08:31 AM. Reason: Thought of more info...

    Leave a comment:


  • kubicle
    replied
    Originally posted by TheBigAmbulance View Post
    There is a file in /etc/rc.d/S99freeradius which matches the above.
    That doesn't sound right, as there is no /etc/rc.d in *buntus (or was that a typo) the start-stop links (for old-school init scripts) should be in runlevel based rcX.d directories.
    You can try running 'sudo update-rc.d freeradius defaults 99 20'
    (This should put start links S99freeradius for runlevels 2-5 (rc2.d to rc5.d) and stop links K20freeradius to runlevels 0, 1 and 6)

    Leave a comment:


  • james147
    replied
    You should be starting it with
    Code:
    sudo start freeradius
    if that works try enabling it to boot at startup:
    Code:
    sudo update-rc.d freeradius enable
    (I would check the update-rc.d man pages first, it has been a while since I have used it)

    Leave a comment:


  • Snowhog
    replied
    Silly question, likely, but is the file executable?

    Leave a comment:


  • TheBigAmbulance
    started a topic freeradius init.d script

    freeradius init.d script

    I've installed freeradius (version 2.1.10) from repositories and what seems to be happening is that the script in init.d does not start the server on boot.

    Here is the /etc/init.d/freeradius file

    Code:
    #!/bin/sh
    # Start/stop the FreeRADIUS daemon.
    
    ### BEGIN INIT INFO
    # Provides:          freeradius
    # Required-Start:    $remote_fs $network $syslog
    # Should-Start:      $time mysql slapd postgresql samba krb5-kdc
    # Required-Stop:     $remote_fs $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Radius Daemon 
    # Description:       Extensible, configurable radius daemon
    ### END INIT INFO
    
    set -e
    
    . /lib/lsb/init-functions
    
    PROG="freeradius"
    PROGRAM="/usr/sbin/freeradius"
    PIDFILE="/var/run/freeradius/freeradius.pid"
    DESCR="FreeRADIUS daemon"
    
    if [ -r /etc/default/$PROG ]; then
      . /etc/default/$PROG
    fi
    
    test -f $PROGRAM || exit 0
    
    # /var/run may be a tmpfs
    if [ ! -d /var/run/freeradius ]; then
      mkdir -p /var/run/freeradius
      chown freerad:freerad /var/run/freeradius
    fi
    
    export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
    
    ret=0
    
    case "$1" in
            start)
                    log_daemon_msg "Starting $DESCR" "$PROG"
                    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM -- $FREERADIUS_OPTIONS || ret=$?
                    log_end_msg $ret
                    exit $ret
                    ;;
            stop)
                    log_daemon_msg "Stopping $DESCR" "$PROG"
                    if [ -f "$PIDFILE" ] ; then
                      start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$?
                    else 
                      log_action_cont_msg "$PIDFILE not found"
                      ret=0
                    fi
                    log_end_msg $ret
                    ;;
            restart)
                    $0 stop
                    $0 start
                    ;;
            reload|force-reload)
                    log_daemon_msg "Reloading $DESCR" "$PROG"
                    if [ -f "$PIDFILE" ] ; then
                      start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE || ret=$?
                    else 
                      log_action_cont_msg "$PIDFILE not found"
                      ret=0
                    fi
                    log_end_msg $ret
                    ;;
            *)
                    echo "Usage: $0 start|stop|restart|force-reload|reload"
                    exit 1 
                    ;;
    esac
    
    exit 0
    There is a file in /etc/rc.d/S99freeradius which matches the above.

    A reboot does not start radius, but manually running /etc/init.d/freeradius starts freeradius without incident.

    Any ideas?

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X