config root man

Current Path : /usr/src/contrib/ntp/scripts/rc2/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/src/contrib/ntp/scripts/rc2/local.ntpd

#! /usr/bin/perl -w
# 980904 Harlan Stenn - created

# vvv CHANGE THESE vvv

$ps = "/bin/ps x |";

$ntp_conf = "/etc/ntp.conf";
$ntpd = "/usr/local/bin/xntpd";
$ntpdate = "/usr/local/bin/ntpdate -b -s 10.0.0.1 10.0.0.2";

# ^^^ CHANGE THESE ^^^

{
  if (0)
    {
    }
  elsif ($ARGV[0] eq "start")
    {
      @pidlist = pidlist($ntpd);
      if (defined(@pidlist))
        {
	  warn "NTP is already running\n";
        }
      else
        {
	  if ( -f $ntp_conf && -x $ntpd )
	    {
	       system ($ntpdate);
	       system ($ntpd." -c ".$ntp_conf);
	    }
        }
    }
  elsif ($ARGV[0] eq "stop")
    {
      @pidlist = pidlist($ntpd);
      kill 'TERM', @pidlist if (scalar(@pidlist) > 0);
    }
  else
    {
      die "Usage: $0 {start,stop}\n";
    }
}

sub pidlist ($)
  {
    my ($target) = @_;
    my ($qt) = quotemeta($target);
    my @pids;

    open(PS, $ps) || die "Can't run ps: $!\n";
    while (<PS>)
      {
	chomp;
	next unless (/$qt/);
	print "Got <$_>\n";
	if (/^\s*(\d+)\s+/)
	  {
	    push @pids, $1;
	  }
      }
    close(PS);
    return @pids;
  }

Man Man