该服务器(Centos 6.8)已经有一个作为服务运行的 Radius 单个实例。
我已经创建了第二个实例,并能够使其成功运行:
radiusd -X -d /etc/raddb2
我现在需要让这个第二个实例作为服务运行。
我知道文件 /etc/chkserv.d/radiusd 包含
service[radiusd]=x,x,x,/etc/init.d/radiusd restart,radiusd,radiusd
...此外,在 /etc/chkserv.d/chkservd.conf 中我将 radius 列为:
radiusd:1
我已将文件 /etc/init.d/radiusd 复制到 /etc/init.d/radiusd2
这些是 radius2 的内容
#!/bin/sh
#
# radiusd Start/Stop the FreeRADIUS daemon
#
# chkconfig: - 88 10
# description: Extensible, configurable, high performance RADIUS server.
### BEGIN INIT INFO
# Provides: radiusd
# Required-Start: $network
# Required-Stop:
# Default-Start:
# Default-Stop:
# Should-Start: $time $syslog mysql ldap postgresql samba krb5-kdc
# Should-Stop:
# Short-Description: FreeRADIUS server
# Description: Extensible, configurable, high performance RADIUS server.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
prog=radiusd
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
exec=${exec:=/usr/sbin/$prog}
config_dir=${config_dir:=/etc/raddb2}
config=${config:=$config_dir/radiusd.conf}
pidfile=${pidfile:=/var/run/$prog/$prog.pid}
lockfile=${lockfile:=/var/lock/subsys/radiusd}
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
daemon --pidfile $pidfile $exec -d $config_dir
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
# radiusd may not be capable of a 100% configuration reload depending
# on which loadable modules are in use, if sending the server a
# HUP is not sufficient then use restart here instead. However, we
# prefer by default to use HUP since it's what is usually desired.
#
# restart
kill -HUP `pidofproc -p $pidfile $prog`
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
...到目前为止,我唯一改变的是将 config_dir 变量更改为 raddb2(radius 的第二个实例所在的位置)
config_dir=${config_dir:=/etc/raddb2}
我想我需要改变
pidfile=${pidfile:=/var/run/$prog/$prog.pid}
类似于:
pidfile=${pidfile:=/var/run/$prog/$prog2.pid}
如果有人能告诉我这是否正确,以及我还需要做什么才能启动并运行第二个实例,我将不胜感激。