diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 02:44:56 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 02:44:56 +0000 |
commit | 73aadcd119083eccba8de9d5b4a2514f50987fed (patch) | |
tree | 720a43d24cf467b2732aa8884338d687f02513da | |
parent | 96381bf0d870cd8e17034dffd926364c835c7f27 (diff) |
modules/admin-core: correct date format in luci_fixtime, save time on shutdown (OpenWrt #6921)
-rwxr-xr-x | modules/admin-core/root/etc/init.d/luci_fixtime | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/admin-core/root/etc/init.d/luci_fixtime b/modules/admin-core/root/etc/init.d/luci_fixtime index f300e45b9..e03d60e1a 100755 --- a/modules/admin-core/root/etc/init.d/luci_fixtime +++ b/modules/admin-core/root/etc/init.d/luci_fixtime @@ -1,11 +1,16 @@ #!/bin/sh /etc/rc.common START=05 +STOP=95 start() { cat <<' EOF' | lua -l luci.fs -l luci.util - if (os.time() < 1000000000) then - os.execute('date -s ' .. os.date('%m%d%H%M%Y', luci.fs.mtime("/etc/init.d/luci_fixtime"))) + os.execute('date -s ' .. os.date('%Y%m%d%H%M', luci.fs.mtime("/etc/init.d/luci_fixtime"))) end EOF } + +stop() { + [[ -w /etc/init.d/luci_fixtime ]] && touch /etc/init.d/luci_fixtime +} |