* Etienne CHAMPETIER <[email protected]> [06.01.2014 08:48]:
> +#!/bin/sh /etc/rc.common
> +# Copyright (C) 2013-2014 OpenWrt.org
> +
> +START=00
> +
> +boot() {
> +     CURTIME=`date +%s`
> +     MAXTIME=`find /etc -type f -exec date +%s -r {} \; | sort | tail -n1`
> +     [[ $CURTIME -lt $MAXTIME ]] && \
> +             date -s @$MAXTIME && \
> +             /usr/bin/logger -t sysfixtime -p daemon.notice "Time fixed"
> +}

sorry for complaining about simple things, but:

try to mimic the openwrt-style. there is no "official" document, but you
can see it in most scripts:

1)
use local vars, e.g.

local curtime=...
local maxtime=...

2)
avoid '`', instead of:

CURTIME=`date +%s` use
CURTIME="$(date +%S)"

3)
instead if calling the logger directly, just use 'logger'

4)
instead of

[[ $CURTIME -lt $MAXTIME ]] && \ ...

use 

[ $curtime -lt $maxtime ] && {
  ...
  ...
}

no need for further discussing,
it's just about common-style in one project... 8-)

one note about the approach: if somebody (e.g. the piratebox-guy)
wants to be more accurate, just set up a cronjob which calls e.g.
'touch /etc/config/system' every 5 minutes...

bye, bastian
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to