AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 420313
Accepted
Quintin Par
Quintin Par
Asked: 2012-08-23 22:34:24 +0800 CST2012-08-23 22:34:24 +0800 CST 2012-08-23 22:34:24 +0800 CST

由于 Date::Manip 问题无法运行 logwatch

  • 772

我试着在下面运行 logwatch

[root@machine cron.daily]# ./0logwatch 
ERROR: Date::Manip unable to determine TimeZone.

Execute the following command in a shell prompt:
        perldoc Date::Manip
The section titled TIMEZONES describes valid TimeZones
and where they can be defined.

我的日期如下

root@machine cron.daily]# date
Thu Aug 23 06:25:21 GMT 2012

现在根据各种论坛中的详细信息,我尝试通过设置来解决此问题

/etc/timezone to “+0800”

但它没有用

我/etc/localtime指向/usr/share/zoneinfo/GMT 并由puppet管理

我该如何解决这个问题?我仍然希望我所有的机器都在 GMT 时区。

编辑:
遗憾的是,
这两项更改均无效:

[root@machine cron.daily]# cat /etc/TIMEZONE 
UTC

广达的

[root@machine cron.daily]# cat ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export TZ=GMT

export PATH
[root@machine cron.daily]# source ~/.bash_profile
[root@machine cron.daily]# ./0logwatch 
ERROR: Date::Manip unable to determine TimeZone.

Execute the following command in a shell prompt:
        perldoc Date::Manip
The section titled TIMEZONES describes valid TimeZones
and where they can be defined.
linux
  • 3 3 个回答
  • 3036 Views

3 个回答

  • Voted
  1. quanta
    2012-08-28T01:00:58+08:002012-08-28T01:00:58+08:00

    您当前的时区是 GMT,为什么设置/etc/timezone为“+0800”?

    perldoc Date::Manip

       The following time zone names are currently understood (and can be used in parsing dates).  These are zones
       defined in RFC 822.
    
           Universal:  GMT, UT
           US zones :  EST, EDT, CST, CDT, MST, MDT, PST, PDT
           Military :  A to Z (except J)
           Other    :  +HHMM or -HHMM
           ISO 8601 :  +HH:MM, +HH, -HH:MM, -HH
    
       In addition, the following time zone abbreviations are also accepted. These do not come from a standard, but were
       included in previous releases of Date::Manip 5.xx and are preserved here for backward compatibility:
    
          IDLW    -1200    International Date Line West
          NT      -1100    Nome
          SAT     -0400    Chile
          CLDT    -0300    Chile Daylight
          AT      -0200    Azores
          MEWT    +0100    Middle European Winter
          MEZ     +0100    Middle European
          FWT     +0100    French Winter
          GB      +0100    GMT with daylight savings
          SWT     +0100    Swedish Winter
          MESZ    +0200    Middle European Summer
          FST     +0200    French Summer
          METDST  +0200    An alias for MEST used by HP-UX
          EETDST  +0300    An alias for eest used by HP-UX
          EETEDT  +0300    Eastern Europe, USSR Zone 1
          BT      +0300    Baghdad, USSR Zone 2
          IT      +0330    Iran
          ZP4     +0400    USSR Zone 3
          ZP5     +0500    USSR Zone 4
          IST     +0530    Indian Standard
          ZP6     +0600    USSR Zone 5
          AWST    +0800    Australian Western Standard
          ROK     +0900    Republic of Korea
          AEST    +1000    Australian Eastern Standard
          ACDT    +1030    Australian Central Daylight
          CADT    +1030    Central Australian Daylight
          AEDT    +1100    Australian Eastern Daylight
          EADT    +1100    Eastern Australian Daylight
          NZT     +1200    New Zealand
          IDLE    +1200    International Date Line East
    
       All other time zone abbreviations come from the standards. In many cases, an abbreviation may be used for multiple
       timezones. For example, NST stands for Newfoundland Standard -0330 and North Sumatra +0630.  In these cases, only
       1 of the two is available. I have tried to use the most recent definition, and of those (if multiple timezones use
       the abbreviation), the most commonly used. I don’t claim that I’m correct in all cases, but I’ve done the best I
       could.
    
       The list of abbreviations available is documented in the Date::Manip::DM5abbrevs document in this module, or more
       fully in the Date::Manip::Zones document of Date::Manip::6.xx.
    
       Date::Manip must be able to determine the time zone the user is in.  It does this by looking in the following
       places:
    
          $Date::Manip::TZ (set with Date_Init or in Manip.pm)
          $ENV{TZ}
          the Unix ‘date‘ command (if available)
          $main::TZ
          /etc/TIMEZONE
          /etc/timezone
    
       At least one of these should contain a time zone in one of the supported forms.  If none do by default, the TZ
       variable must be set with Date_Init.
    
       The time zone may be in the STD#DST format (in which case both abbreviations must be in the table above) or any of
       the formats described above.  The STD#DST format is NOT available when parsing a date however.  The following
       forms are also available and are treated similar to the STD#DST forms:
    
             US/Pacific
             US/Mountain
             US/Central
             US/Eastern
             Canada/Pacific
             Canada/Mountain
             Canada/Central
             Canada/Eastern
    

    Date::Manip你运行的是哪个版本?

    如果出于某些原因,Perl 不读取/etc/timezoneor /etc/TIMEZONE,您可以将此行添加到/root/.bash_profile:

    export TZ=GMT
    

    运行后立即生效,source /root/.bash_profile然后重试。


    更新 8 月 30 日星期四 10:55:54 ICT 2012

    尝试在 logwatch perl 脚本中设置时区:

    use Date::Manip;
    
    Date_Init("TZ=GMT");
    
    • 4
  2. Best Answer
    Quintin Par
    2012-09-02T06:46:34+08:002012-09-02T06:46:34+08:00

    实际上这有效

    export DATE_MANIP=DM5
    
    • 2
  3. Michael Hampton
    2012-08-28T00:55:13+08:002012-08-28T00:55:13+08:00

    这不是修复,而是解决方法。但它应该让你去。

    它不起作用的原因是it's expecting TIMEZONEto be capitalized。

    echo UTC > /etc/TIMEZONE
    
    • 1

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve