Real-Time clock
Peter Trapp
openmoko at genial.ms
Thu Mar 13 12:17:26 CET 2008
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