システムサービススクリプトでローカルに構築されたntpdを起動できません。

システムサービススクリプトでローカルに構築されたntpdを起動できません。

私はソースからntpdを作成し、プロセスはそれを/usr/local/sbinに入れました。もちろん、ntpサービスは/ usr / sbinを指します。だから私はinit.d設定ファイルのパスを次のように変更できると思いました。

### BEGIN INIT INFO
# Provides:        ntp
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:
# Short-Description: Start NTP daemon
### END INIT INFO

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

. /lib/lsb/init-functions

DAEMON=/usr/local/sbin/ntpd
PIDFILE=/var/run/ntpd.pid
...[etc]

新しいバイナリの位置を指すように「DAEMON」で始まる行を変更しました。ただし、サービスを再起動しようとすると、次のエラーが発生します。

[ ok ] Stopping NTP server: ntpd.
[....] Starting NTP server: ntpd/usr/local/sbin/ntpd: The 'user' option has been disabled. -- built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs
ntpd - NTP daemon program - Ver. 4.2.7p475
Usage:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
                [ <server1> ... <serverN> ]
Try 'ntpd --help' for more information.
 failed!

/usr/sbinの代わりに/usr/local/sbinでサービスを実行するにはどうすればよいですか?

ソリューション(許可された回答基準):

明らかにLinuxで構築するときは、このスイッチを使用する必要があります--enable-linuxcaps。 Debian Wheezyに必要な手順は次のとおりです。

cd ~/install/ntp-dev-4.2.7p475     # or wherever you have the source unpacked
make clean                         # clean out the previous build
sudo apt-get install libcap-dev    # this library is required by linuxcaps
./configure --enable-linuxcaps     # this is the critical switch
make
sudo make install
sudo /etc/init.d/ntp restart       # restart ntp
ntpq -c "rv 0 version"             # make sure you are running the right version

上記のように、/etc/init.d/ntpで変更する必要がある唯一の行はDAEMON行です。

ベストアンサー1

あなたは選択の余地ntpdなく状況を整理しました--enable-linuxcaps。これがなければntpd認識できない。ユーザーオプション-u

あなたのオプションは次のとおりです。

  • 正しいオプションで再コンパイル

  • -u $UGIDNTPD_OPTS行から削除/etc/init.d/ntp

おすすめ記事