Walt Mankowski on 9 Feb 2006 20:15:47 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] debian and ntpd / ntpdate


On Thu, Feb 09, 2006 at 02:54:22PM -0500, Eugene Smiley wrote:
> Jeff Abrahamson wrote:
> > Debian says that ntpd doesn't start automatically nor even provide an
> > init.d script because the maintainer can't find a solution that works
> > sufficiently broadly.  Result, "apt-get install ntp" doesn't have
> > quite the intended behavior.  Sadly, the distro doesn't include any
> > sample scripts for init.d/, either.
> 
> That's funny, /etc/init.d/ntp-server (start|stop) works for me. I'll grant that
> I must pay attention to if its running after reboot.

I've got an /etc/init.d/ntp-server in my installation, too.  It seems
to work fine.  I've attached it in case you went to take a look.  It
doesn't seem to be doing any magic though.

Walt

#!/bin/sh -e

PATH=/sbin:/bin:/usr/bin

test -f /usr/sbin/ntpd || exit 0

RUNASUSER=ntp
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true

if [ -z "$UGID" ]; then
  echo "User $USER does not exist" >&2
  exit 1
fi

case "$1" in
	start)
		echo -n "Starting NTP server: ntpd"
  		start-stop-daemon --start --quiet --pidfile /var/run/ntpd.pid --exec /usr/sbin/ntpd -- -p /var/run/ntpd.pid -u $UGID
		echo "."
  		;;
	stop)
		echo -n "Stopping NTP server: ntpd"
  		start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
		echo "."
		rm -f /var/run/ntpd.pid
  		;;
	restart|force-reload)
		echo -n "Restarting NTP server: ntpd... "
  		start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
  		sleep 2
  		start-stop-daemon --start --quiet --exec /usr/sbin/ntpd -- -p /var/run/ntpd.pid -u $UGID
		echo "done."
  		;;
	reload)
		echo "Not supported, sorry. Use 'restart' or 'force-reload'." >&2
		exit 1
		;;
	*)
  		echo "Usage: /etc/init.d/ntp-server {start|stop|restart|force-reload}"
  		exit 1
		;;
esac

exit 0

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug