Ticket #6921: luci_fixtime

File luci_fixtime, 323 bytes (added by gravydish@…, 6 years ago)

Working luci_fixtime script (also save system time at shutdown)

Line 
1#!/bin/sh /etc/rc.common
2
3START=05
4STOP=95
5
6start() {
7        cat <<' EOF' | lua -l luci.fs -l luci.util -
8                if (os.time() < 1000000000) then
9                        os.execute('date -s ' .. os.date('%Y%m%d%H%M', luci.fs.mtime("/etc/init.d/luci_fixtime")))
10                end
11        EOF
12}
13
14stop() {
15        [[ -w /etc/init.d/luci_fixtime ]] && touch /etc/init.d/luci_fixtime
16}