Bash 为什么CRON_TZ设置在/etc/crontab不起作用?
在Bash 为什么CRON_TZ设置在/etc/crontab不起作用?,bash,shell,cron,timezone,Bash,Shell,Cron,Timezone,在/etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root CRON_TZ=Asia/Tokyo # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .----------
/etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
CRON_TZ=Asia/Tokyo
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
在一个用户下创建了一个cron作业作为
crontab -e
0 1 * * * echo 'task' > /tmp/task
它在东京1点没有运行。但是在9小时之前。是UTC。为什么
/etc/crontab
不能在全球范围内工作?根据我在谷歌搜索时发现的情况,它在发行版和版本上差异很大,但您可能需要设置一个额外的TZ
变量,或者更新/etc/localtime
@SomethingDark/etc/localtime
中的时区,它是一个二进制文件。我可以将TZ
添加到/etc/crontab
。