Back to the main page

Fix radius Solaris service

Hi, quick article about real time problem. The quick intro:
There is the Solaris non-global zone, to be Radius server. The freeradius was installed from Sunfreeware, and integrated into Solaris service framework. So the problem is that when non-global zone reboots, somehow the radius service doesn't start. Yes we can troubleshoot, but let's for this excersise create the RC script that check/fix the radius service when system boots.

The fix script is /etc/init.d/check_radius_service

#!/bin/sh
#set -x
# wait for - minutes
sleep 60

# subroutines

progress() {
for i in F I X R A D I U S
do
        echo "${i}\c"
        sleep 1
done
}

notifyme() {
        echo "The ${SERVICE} will be disabled/enabled" \
        | mailx -s "The ${SERVICE} isn't online after non-global zone ${ZONE} rebooted" ${ADMIN}
}

notifymeagain() {
        echo "Attempt to enable ${SERVICE} has failed" \
        | mailx -s "${SERVICE} cannot be enabled, check it manually" ${ADMIN}
}

ZONE=`hostname`
ADMIN=admin@mydomain.ca
SERVICE=radius
STATUS=`svcs -H ${SERVICE} | awk '{print $1}'`

# if service is not online, send email and disable/enable service
if [ ${STATUS} = online ]; then
        exit 0
else
        notifyme
        /usr/sbin/svcadm disable ${SERVICE}
        progress
        #progress | tee -a /dev/console
        /usr/sbin/svcadm enable -r ${SERVICE}
fi

# check service status again
sleep 5
[ `svcs -H ${SERVICE} | awk '{print $1}'` != online ] && notifymeagain

exit 0
Once there is the script, create symbolic link 'S99check_radius_service' to this script in the /etc/rc3.d directory. The 'S99' says this fix runs after all RC scripts for level 3 are performed, this is not real RC script people are used for, but works here.
And next time zone reboots, this checks radius service and fix it if needed and also sends email to the admin.

Back to the main page