Hardware Reference
In-Depth Information
Now you're going to create two files under the
/storage/.config
directory: an NTP
config file and the autostart file. Create a file using vi called
ntp.conf
with the contents of
Listing 7-3. Do note I said to use vi, not Vim. Vim is not installed on OpenELEC; the basic
commands will be the same as Vim so you're fine.
Listing 7-3.
The ntp.conf File
3.
server 0.asia.pool.ntp.org iburst
driftfile /var/lib/ntp/ntp.drift
restrict default nomodify nopeer
restrict 127.0.0.1
interface ignore all
interface listen eth0
4.
Change your server to a different NTP server close to your region. Check
http://pool.ntp.org
for this information.
Next, in the same directory create a file called
autostart.sh
. Enter the contents of Listing 7-4
into this file. This will start
the NTP daemon
with the config file we created before.
Listing 7-4.
The autostart.sh File
5.
#!/bin/sh
# Autostart for ntp
/usr/sbin/ntpd -c /storage/.config/ntp.conf
The last step is setting the
autostart
file to have execution permissions. Do that with the
following command:
6.
# chmod +x /storage/.config/autostart.sh
It's now a good time to reboot your Raspberry Pi to make the
NTP
daemon start on boot.
In Figure
7-12
you can see where
NTP
has printed information into the
message
log by running this command:
# cat messages | grep ntp
Figure 7-12.
The NTP daemon starting with the correct time