FW: Real-Time clock

George Eliozov nerozero at itcs.ge
Thu Mar 13 13:22:20 CET 2008


:) It was rhetorical question ;) 
I know what is doing this script.. :) if you follow previous messages, you
will find that I have problem with time, after restarting time was the same
as before shutting down. And the problem was in that script.. Now time is
working normally.. Thanks!

Anyway thanks for explaining!!! 

-----Original Message-----
From: Peter Trapp [mailto:openmoko at genial.ms] 
Sent: Thursday, March 13, 2008 3:17 PM
To: device-owners at lists.openmoko.org; George Eliozov
Subject: RE: Real-Time clock

This script will be called while system startup/shutdown. The appropriate
link should be located in the folder rc.d ...

As option it takes one of the following:   start     stop    restart

start does: 
>     if [ ! -e $DATEFILE ]; then
check if DATEFILE NOT exist

>         LASTDATETIME=100208002007

LASTDATETIME, here 100208002007   means according to "%m%d%H%M%G"
  Feb 10, 2007    08:00a.m.

=> reset date and time to default



>     else
>         . $DATEFILE

used stored value from DATEFILE  (this file was written on last shutdown of
neo)
(exports the variable LASTDATETIME to shell, like     `export
LASTDATETIME=mmddHHMMYYYY`


>     fi
>     date -u $LASTDATETIME
>        ;;

set time and date according to LASTDATETIME (either lastvalue or
defaultvalue)


stop:
>         echo "LASTDATETIME=`/bin/date -u +%m%d%H%M%G`" > $DATEFILE
get actual time and store it in DATEFILE


restart:
do start
do stop

cheers
-homyx



Von: "George Eliozov" <nerozero at itcs.ge>
> Could anyone tall me, what is doing this script: 
> 
> cat /etc/init.d/date.sh
> =============================================
> #!/bin/sh
> DATEFILE=/etc/default/lastdate
> case "$1" in
>   start)
>     if [ ! -e $DATEFILE ]; then
>         LASTDATETIME=100208002007
>     else
>         . $DATEFILE
>     fi
>     date -u $LASTDATETIME
>        ;;
>   stop)
>         echo "LASTDATETIME=`/bin/date -u +%m%d%H%M%G`" > $DATEFILE
>         ;;
>   restart)
>         $0 stop
>         $0 start
>         ;;
>   *)
>         echo "Usage: date.sh {start|stop|restart}"
>         exit 1
> esac
> 
> exit 0
> 
> 
> 

-- 
for Windows problems reboot
for Linux problems be root




More information about the device-owners mailing list