時計を合わせる

SheevaPlug

U-Boot, Kernel, root fs の一通りが最新になったので、 そろそろまともにする。

時計を合わせる

root@debian:~# date
Mon Jan 26 18:00:35 UTC 2009
root@debian:~# date 100315402009
Sat Oct  3 15:40:00 UTC 2009
root@debian:~#
って、UTC やん

Time Zone の設定

root@debian:~# cd /etc/default/
root@debian:/etc/default# grep UTC *
rcS:UTC=yes
root@debian:/etc/default# TZ=JST-9
root@debian:/etc/default# export TZ
root@debian:/etc/default# date 100315422009
Sat Oct  3 15:42:00 JST 2009
root@debian:/etc/default# 
これではあかんな reconfigure する。
root@debian:/etc/default# dpkg-reconfigure tzdata

Package configuration
 敖陳陳陳陳陳陳陳陳陳陳陳陳調 Configuring tzdata 団陳陳陳陳陳陳陳陳陳陳陳陳陳
 審 Please select the geographic area you live in. Subsequent configuration
 崖 questions will narrow this down by presenting a list of cities,
 崖 representing the time zones in which they are located.
 崖
 崖 Geographic area:
 崖
 崖                               Australia
 崖                               Arctic                                     嘘
                                柿sia                                       嘘
                                柿tlantic                                   嘘
                                嚇urope                                     嘘
                                撹ndian                                     嘘
                                覚acific                                    嘘
                                較ystemV                                    朿
                                嚇tc
 崖
 崖
 崖                                            
 崖
 垣陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳潰


コピペすると化け化けだが、、Asia を選んで、
Package configuration
        敖陳陳陳陳陳陳陳陳陳調 Configuring tzdata 団陳陳陳陳陳陳陳陳陳朕
         覚lease select the time zone corresponding to your location.
        崖
        崖 Time zone:
        崖
        崖                      Singapore
                                Taipei                                嘘
                                Tashkent                              嘘
                                Tbilisi                               嘘
                                Tehran                                朿
                                Tel_Aviv                              嘘
                                Thimphu                               嘘
                                Tokyo                                 嘘
                                Ujung_Pandang    越                   嘘
                                Ulaanbaatar                           嘘
                                Urumqi
        崖
        崖
        崖                                  
        崖
        垣陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳


Tokyo を選ぶ
Current default timezone: 'Asia/Tokyo'
Local time is now:      Sat Oct  3 15:44:19 JST 2009.
Universal Time is now:  Sat Oct  3 06:44:19 UTC 2009.
これでログイン直後から JST で表示されるようになる。
root@debian:~# date
Sat Oct  3 15:45:04 JST 2009
root@debian:~# exit
logout

Ubuntu jaunty (development branch) debian ttyS0

debian login: root
Password:
Last login: Mon Jan 26 18:00:56 JST 2009 on ttyS0
Linux debian 2.6.22.18 #1 Fri Apr 3 18:49:38 PDT 2009 armv5tejl

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
root@debian:~# date
Sat Oct  3 15:45:17 JST 2009
root@debian:~#

リブート

root@debian:~# shutdown -r now
	:
on Jan 26 18:00:00 JST 2009

Ubuntu jaunty (development branch) debian ttyS0

debian login: root
Password:
Last login: Sat Oct  3 15:45:15 JST 2009 on ttyS0
Linux debian 2.6.22.18 #1 Fri Apr 3 18:49:38 PDT 2009 armv5tejl

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
root@debian:~# date
Mon Jan 26 18:00:49 JST 2009
root@debian:~#
なぜ 1/26 ?

/etc/rc.local

散歩していて見つけた
root@debian:~# grep date /etc/*
	:
	:
/etc/rc.local:date 012618002009
	:
	:
root@debian:~#
なんだこれ?
root@debian:~# less /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
insmod /boot/fat.ko
insmod /boot/vfat.ko
mkdir -p /var/cache/apt/archives/partial
/root/discoverd
cd /
#./demo.sh
date 012618002009
hwclock -w

exit 0
/etc/rc.local (END)
腐ってる。
LinkStation と同じくバッテリバックアップされていないので、 とりあえず 1/26 をセットしたのだろう。

セットしなければどうなる?

root@debian:~# cd /etc
root@debian:/etc# mv rc.local rc.local.orig
root@debian:/etc# cp rc.local.orig rc.local
root@debian:/etc# vi rc.local
	:
	:
root@debian:/etc# diff -c rc.local.orig rc.local
*** rc.local.orig       Tue Jan 27 03:00:10 2009
--- rc.local    Mon Jan 26 18:15:00 2009
***************
*** 16,22 ****
  /root/discoverd
  cd /
  #./demo.sh
! date 012618002009
! hwclock -w

  exit 0
--- 16,22 ----
  /root/discoverd
  cd /
  #./demo.sh
! #date 012618002009
! #hwclock -w

  exit 0
root@debian:/etc#
電源を抜いて再起動

debian login:                                                            [ OK ]
                                                                                * Starting kernel log daemon...                                          [ OK ]
                                                                                * Starting OpenBSD Secure Shell server sshd                              [ OK ]
                                                                                * Starting periodic command scheduler crond                              [ OK ]

Ubuntu jaunty (development branch) debian ttyS0

debian login: root
Password:
Last login: Mon Jan 26 18:00:48 JST 2009 on ttyS0
Linux debian 2.6.22.18 #1 Fri Apr 3 18:49:38 PDT 2009 armv5tejl

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
root@debian:~# date
Mon Jan 26 18:19:34 JST 2009
root@debian:~#
電源をちょっと抜いただけだったら、もっているみたい。

ntpdate

root@debian:~# which ntpdate
/usr/sbin/ntpdate
root@debian:~#
ntpdate がある。
root@debian:~# ntpdate 192.168.1.3
 4 Oct 17:27:23 ntpdate[1288]: adjust time server 192.168.1.3 offset 0.002249 sec
root@debian:~#
同期もできる。
(192.168.1.3 はもちろん山下家の内向き NTP サーバ)

/etc/rc.local に書いておく

root@debian:~# !diff
diff -c /etc/rc.local.orig /etc/rc.local
*** /etc/rc.local.orig  Tue Jan 27 03:00:10 2009
--- /etc/rc.local       Sun Oct  4 17:34:00 2009
***************
*** 16,22 ****
  /root/discoverd
  cd /
  #./demo.sh
! date 012618002009
  hwclock -w

  exit 0
--- 16,23 ----
  /root/discoverd
  cd /
  #./demo.sh
! #date 012618002009
! /usr/sbin/ntpdate 192.168.1.3
  hwclock -w

  exit 0
root@debian:~#
将来的には ntp で同期する。


←(前のページ)
root fs の書込み(2)
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
シャットダウン

Copyright (C) 2003-2009 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市