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

前端之家收集整理的这篇文章主要介绍了linux – 由于Date :: Manip问题,无法运行logwatch前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试着按照以下方式运行logwatch
  1. [root@machine cron.daily]# ./0logwatch
  2. ERROR: Date::Manip unable to determine TimeZone.
  3.  
  4. Execute the following command in a shell prompt:
  5. perldoc Date::Manip
  6. The section titled TIMEZONES describes valid TimeZones
  7. and where they can be defined.

我的约会日期如下

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

现在基于各种论坛的细节,我试图通过设置来解决这个问题

  1. /etc/timezone to “+0800

但它不起作用

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

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

编辑:
可悲的是,
这两个更改都不起作用:

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

广达

  1. [root@machine cron.daily]# cat ~/.bash_profile
  2. # .bash_profile
  3.  
  4. # Get the aliases and functions
  5. if [ -f ~/.bashrc ]; then
  6. . ~/.bashrc
  7. fi
  8.  
  9. # User specific environment and startup programs
  10.  
  11. PATH=$PATH:$HOME/bin
  12. export TZ=GMT
  13.  
  14. export PATH
  15. [root@machine cron.daily]# source ~/.bash_profile
  16. [root@machine cron.daily]# ./0logwatch
  17. ERROR: Date::Manip unable to determine TimeZone.
  18.  
  19. Execute the following command in a shell prompt:
  20. perldoc Date::Manip
  21. The section titled TIMEZONES describes valid TimeZones
  22. and where they can be defined.

解决方法

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

perldoc Date :: Manip

  1. The following time zone names are currently understood (and can be used in parsing dates). These are zones
  2. defined in RFC 822.
  3.  
  4. Universal: GMT,UT
  5. US zones : EST,EDT,CST,CDT,MST,MDT,PST,PDT
  6. Military : A to Z (except J)
  7. Other : +HHMM or -HHMM
  8. ISO 8601 : +HH:MM,+HH,-HH:MM,-HH
  9.  
  10. In addition,the following time zone abbreviations are also accepted. These do not come from a standard,but were
  11. included in prevIoUs releases of Date::Manip 5.xx and are preserved here for backward compatibility:
  12.  
  13. IDLW -1200 International Date Line West
  14. NT -1100 Nome
  15. SAT -0400 Chile
  16. CLDT -0300 Chile Daylight
  17. AT -0200 Azores
  18. MEWT +0100 Middle European Winter
  19. MEZ +0100 Middle European
  20. FWT +0100 French Winter
  21. GB +0100 GMT with daylight savings
  22. SWT +0100 Swedish Winter
  23. MESZ +0200 Middle European Summer
  24. FST +0200 French Summer
  25. METDST +0200 An alias for MEST used by HP-UX
  26. EETDST +0300 An alias for eest used by HP-UX
  27. EETEDT +0300 Eastern Europe,USSR Zone 1
  28. BT +0300 Baghdad,USSR Zone 2
  29. IT +0330 Iran
  30. ZP4 +0400 USSR Zone 3
  31. ZP5 +0500 USSR Zone 4
  32. IST +0530 Indian Standard
  33. ZP6 +0600 USSR Zone 5
  34. AWST +0800 Australian Western Standard
  35. ROK +0900 Republic of Korea
  36. AEST +1000 Australian Eastern Standard
  37. ACDT +1030 Australian Central Daylight
  38. CADT +1030 Central Australian Daylight
  39. AEDT +1100 Australian Eastern Daylight
  40. EADT +1100 Eastern Australian Daylight
  41. NZT +1200 New Zealand
  42. IDLE +1200 International Date Line East
  43.  
  44. All other time zone abbreviations come from the standards. In many cases,an abbreviation may be used for multiple
  45. timezones. For example,NST stands for Newfoundland Standard -0330 and North Sumatra +0630. In these cases,only
  46. 1 of the two is available. I have tried to use the most recent definition,and of those (if multiple timezones use
  47. the abbreviation),the most commonly used. I dont claim that Im correct in all cases,but Ive done the best I
  48. could.
  49.  
  50. The list of abbreviations available is documented in the Date::Manip::DM5abbrevs document in this module,or more
  51. fully in the Date::Manip::Zones document of Date::Manip::6.xx.
  52.  
  53. Date::Manip must be able to determine the time zone the user is in. It does this by looking in the following
  54. places:
  55.  
  56. $Date::Manip::TZ (set with Date_Init or in Manip.pm)
  57. $ENV{TZ}
  58. the Unix date command (if available)
  59. $main::TZ
  60. /etc/TIMEZONE
  61. /etc/timezone
  62.  
  63. At least one of these should contain a time zone in one of the supported forms. If none do by default,the TZ
  64. variable must be set with Date_Init.
  65.  
  66. The time zone may be in the STD#DST format (in which case both abbreviations must be in the table above) or any of
  67. the formats described above. The STD#DST format is NOT available when parsing a date however. The following
  68. forms are also available and are treated similar to the STD#DST forms:
  69.  
  70. US/Pacific
  71. US/Mountain
  72. US/Central
  73. US/Eastern
  74. Canada/Pacific
  75. Canada/Mountain
  76. Canada/Central
  77. Canada/Eastern

您正在运行哪个Date :: Manip版本?

如果由于某些原因,Perl不读取/ etc / timezone或/ etc / TIMEZONE,则可以将此行添加到/root/.bash_profile中:

  1. export TZ=GMT

通过运行源/root/.bash_profile使其立即生效,然后重试.

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

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

  1. use Date::Manip;
  2.  
  3. Date_Init("TZ=GMT");

猜你在找的Linux相关文章