-
Notifications
You must be signed in to change notification settings - Fork 151
Using time zones
If some of Entware-ng daemons uses GMT time instead of local time, you may fix it by following this manual.
For ARM/x86 devices only: you should have write access to /etc
.
Just put local zone name to /opt/etc/TZ
.
echo UCT-8 > /opt/etc/TZ
There is the other ways to set up time zone on MIPS devices, like TZ
variable or linking /opt/etc/TZ
with full time zone file from zoneinfo*, but this is the simplest one.
List available time zone packages:
opkg list zoneinfo*
Install desired one:
opkg install zoneinfo-europe
Create /opt/etc/TZ
symlink to chosen time zone:
ln -sf /opt/share/zoneinfo/Europe/Moscow /etc/localtime
Some of firmwares (Tomato, asuswrt and others) keeps /etc/
in tmpfs so it will be lost on the next boot. Create a script /opt/etc/init.d/S00timezone
, that makes a symlink at boot time:
#!/bin/sh
start() {
ln -sf /opt/share/zoneinfo/Europe/Moscow /etc/localtime
}
stop() {
rm -rf /etc/localtime
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
and make it executable:
chmod +x /opt/etc/init.d/S00timezone
Some firmwares to not have write access to /etc folder. In this case you can set timezone through TZ variable by setting it to TZ=:/opt/share/zoneinfo/Europe/Moscow
. Just add this line to /opt/etc/init.d/rc.unslung before the services cycle. Add export TZ=:/opt/share/zoneinfo/Europe/Moscow
to .profile in your HOME directory or to /opt/etc/profile
(globally).
- GNU C Library: TZ variable - http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html