Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: risshuu on November 29, 2016, 05:16:19 AM
-
I was able to fix my RasPi's time by using the timezone file. When I use the date command, it prints the right time.
However, when I use cron to echo the date command to a file, it uses UTC time. Why? Is there a way to fix this?
-
Looks like if I use the cron bootcode, it uses UTC time no matter if I use the timezone file or not. If I stop/start it when booted up, the time cron sees is the local time.
-
Set your timezone on the commandline. Look at the TZ bootcode
-
Set your timezone on the commandline. Look at the TZ bootcode
Yes that is correct, you need to set both "tz=" and "cron" bootcodes. Check /etc/init.d/tc-config to see how it works.
Here is the crontab file I used to test everything is working OK. The filename, contents and timestamp should match.
$ crontab -l -u root
*/1 0 * * * date >> /tmp/crontime0
*/1 1 * * * date >> /tmp/crontime1
*/1 2 * * * date >> /tmp/crontime2
*/1 3 * * * date >> /tmp/crontime3
*/1 4 * * * date >> /tmp/crontime4
*/1 5 * * * date >> /tmp/crontime5
*/1 6 * * * date >> /tmp/crontime6
*/1 7 * * * date >> /tmp/crontime7
*/1 8 * * * date >> /tmp/crontime8
*/1 9 * * * date >> /tmp/crontime9
*/1 10 * * * date >> /tmp/crontime10
*/1 11 * * * date >> /tmp/crontime11
*/1 12 * * * date >> /tmp/crontime12
*/1 13 * * * date >> /tmp/crontime13
*/1 14 * * * date >> /tmp/crontime14
*/1 15 * * * date >> /tmp/crontime15
*/1 16 * * * date >> /tmp/crontime16
*/1 17 * * * date >> /tmp/crontime17
*/1 18 * * * date >> /tmp/crontime18
*/1 19 * * * date >> /tmp/crontime19
*/1 20 * * * date >> /tmp/crontime20
*/1 21 * * * date >> /tmp/crontime21
*/1 22 * * * date >> /tmp/crontime22
*/1 23 * * * date >> /tmp/crontime23
-
Thanks!
-
Set your timezone on the commandline. Look at the TZ bootcode
Could you please elaborate on how to do this.
I'm amiss...
Thanks for your help.
43S
-
see: http://wiki.tinycorelinux.net/wiki:boot_codes_explained
-
Also, you might wanna check out:
http://tinycorelinux.net/8.x/x86/tcz/tzdata.tcz.info (http://tinycorelinux.net/8.x/x86/tcz/tzdata.tcz.info)
-
I stuck the timezone correction just before the call to the script in crontab.
*/5 * * * * TZ=EST-10 date >> /tmp/date.log
http://forum.tinycorelinux.net/index.php/topic,17638.msg106134.html#msg106134
-
Problem solved.
Thanks for your help. ;)
43S