|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /etc/rc.d/rc3.d/ |
Upload File : |
#!/bin/bash
#
# mydns This shell script takes care of starting and stopping
# mydns (DNS server).
#
# chkconfig: 2345 43 43
# description: MyDNS is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true
# Source function library.
. /etc/rc.d/init.d/cpfunctions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
RETVAL=0
prog="mydns"
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -x /usr/local/cpanel/3rdparty/sbin/mydns ] || exit 0
[ -r /etc/mydns.conf ] || exit 0
start() {
# Start daemons.
if [ -n "`/sbin/pidof mydns`" ]; then
echo -n $"$prog: already running"
return 1
fi
echo -n $"Starting $prog: "
/usr/local/cpanel/3rdparty/sbin/mydns --background
RETVAL=$?;
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mydns
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Stopping $prog: "
killproc mydns
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mydns
echo
return $RETVAL
}
rhstatus() {
echo -n $"Reloading $prog: "
p=`/sbin/pidof -o %PPID mydns`
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/usr/bin/kill -USR1 $p;
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/usr/bin/kill -USR2 $p;
RETVAL=$?
fi
fi
echo
return $RETVAL
}
restart() {
stop
# wait a couple of seconds for the named to finish closing down
sleep 2
start
}
reload() {
echo -n $"Reloading $prog: "
p=`/sbin/pidof -o %PPID mydns`
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/usr/bin/kill -HUP $p;
RETVAL=$?
fi
[ "$RETVAL" -eq 0 ] && success $"$prog reload" || failure $"$prog reload"
echo
return $RETVAL
}
probe() {
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
p=`/sbin/pidof -o %PPID mydns`
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
/usr/bin/kill -HUP $p;
RETVAL=$?
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart)
restart
;;
condrestart)
if [ -e /var/lock/subsys/mydns ]; then restart; fi
;;
reload)
reload
;;
probe)
probe
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|probe}"
exit 1
esac
exit $?