起動スクリプトについて

221 views
Skip to first unread message

c.k

unread,
Mar 12, 2014, 9:33:57 PM3/12/14
to cevrza1...@googlegroups.com
CEV_Linux_SDK_V2.00.01 において

起動時に、ntpdate コマンド ( $ ntpdate -p [NTPサーバー] ) を使って時刻取得したいのですが、
起動スクリプトはどのファイルになるでしょうか?

/etc/rc や /etc/rc.local のようなファイルがないのですが、この名前で作成すれば良いでしょうか?
それとも /etc/init.d/rcS ?

以上、よろしくお願いします。

cevrza1l-board

unread,
Mar 12, 2014, 10:31:41 PM3/12/14
to cevrza1...@googlegroups.com
起動スクリプトは、以下のように作成できます。

例:/etc/init.d/S90ntpdate に ntpdateを起動するスクリプトを作成する
以下のファイルを作成してbuildrootをmakeする
buildroot-2013.08.1-{version}/board/cev/cevrza1l/fs/etc/init.d/S90ntpdate
----------------------------------------------------------
#!/bin/sh

echo "Starting ntpdate..."
/usr/bin/ntpdate -b {ntpサーバ}
----------------------------------------------------------

また、cronを使って定期的にntpdateで時刻を合わせる事もできます。

例:/var/spool/cron/crontabs/rootファイルを使ってで定期的にntpdateで時刻を合わせる
以下のファイルを作成してbuildrootをmakeする
buildroot-2013.08.1-{version}/board/cev/cevrza1l/fs/var/spool/cron/crontabs/root
----------------------------------------------------------
# Example of /var/spool/cron/crontab/root:
#
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr,...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,...
# |  |  |  |  |
# *  *  *  *  * command to be executed

# 1時間毎にntpdateを実行する
0 */1  * * * /usr/bin/ntpdate -b {ntpサーバ}
----------------------------------------------------------

以上です。色々とお試しください。
よろしくお願いします。

c.k

unread,
Mar 13, 2014, 12:29:23 AM3/13/14
to cevrza1...@googlegroups.com
S90ntpdate 作成後、他のスクリプトと同様の権限を与える事で動作しました。
cron も試そうと思っていたので助かります。

ありがとうございました。
Reply all
Reply to author
Forward
0 new messages