[openntpd] Surveillance d'openntpd

Utilise un autre script d'init.d qui recupere le PID du ntpd lance ...

darcs-hash:20090423163448-ddb99-a1851d5431c390902dc1045bd939c9039935ccfb.gz
This commit is contained in:
Michel Blockelet 2009-04-23 18:34:48 +02:00
parent e792111b02
commit 763827d937
4 changed files with 82 additions and 0 deletions

View file

@ -1,4 +1,5 @@
<Bundle name="openntpd">
<ConfigFile name="/etc/init.d/openntpd"/>
<ConfigFile name="/etc/openntpd/ntpd.conf"/>
<Package name="openntpd"/>
<Service name="openntpd"/>

View file

@ -0,0 +1,3 @@
<FileInfo>
<Info owner='root' group='root' perms='0755'/>
</FileInfo>

View file

@ -0,0 +1,74 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: openntpd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start openntpd at boot time
# Description: NTP, the Network Time Protocol, is used to keep the
# computer clocks synchronized.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ntpd
NAME=ntpd
DESC=openntpd
PIDFILE=/var/run/openntpd/ntpd.pid
test -e /usr/sbin/openntpd || exit 0
# Include openntpd defaults if available
if [ -f /etc/default/openntpd ]
then
. /etc/default/openntpd
fi
set -e
check_privsep_dir()
{
# check that the privsep dir exists
if [ ! -d /var/run/openntpd ]
then
mkdir /var/run/openntpd
chmod 0755 /var/run/openntpd
fi
}
case "$1" in
start)
check_privsep_dir
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
ps aux | egrep "^root .* /usr/sbin/ntpd$" | awk '{print $2}' > $PIDFILE
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/openntpd/ntpd.pid --exec $DAEMON
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/openntpd/ntpd.pid --exec $DAEMON
sleep 1
check_privsep_dir
start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
ps aux | egrep "^root .* /usr/sbin/ntpd$" | awk '{print $2}' > $PIDFILE
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View file

@ -108,6 +108,10 @@ service("postfix",
pidp="/var/spool/postfix/pid/master.pid",
extra=["if failed port 25 protocol smtp timeout 30 seconds then restart"])
service("crans-common",
name="openntpd",
pidf="openntpd/ntpd")
service("openvpn-ovh",
pidf="openvpn.ovh",
init="openvpn")