diff options
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/etc/init.d/sysfixtime | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/package/base-files/files/etc/init.d/sysfixtime b/package/base-files/files/etc/init.d/sysfixtime new file mode 100755 index 0000000000..525d765758 --- /dev/null +++ b/package/base-files/files/etc/init.d/sysfixtime @@ -0,0 +1,13 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013-2014 OpenWrt.org + +START=00 + +boot() { + local curtime="$(date +%s)" + local maxtime="$(find /etc -type f -exec date +%s -r {} \; | sort -nr | head -n1)" + [ $curtime -lt $maxtime ] && \ + date -s @$maxtime && \ + logger -t sysfixtime -p daemon.notice "Time fixed" +} + |