touch command creates file one hour behind

General support questions
Post Reply
mianasbat
Posts: 1
Joined: 2017/11/15 10:17:07

touch command creates file one hour behind

Post by mianasbat » 2017/11/15 10:19:25

All ordinary users on my linux box have an issue. When they create a file using `$ touch test.txt` or using script and do `ls -ali | grep test.txt` I notice that the time of the file is one hour behind current time.

I checked system time using `$ date` command and it shows the current time. I also tried adding:

`TZ="/usr/share/zoneinfo/Europe/London" export TZ`

Then logged out and logged in again but same issue. How to fix the issue so that the new files are created with the current time?

I have CentOS release 6.6

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: touch command creates file one hour behind

Post by TrevorH » 2017/11/15 10:42:21

Start by yum update to get current. 6.6 is out of date and highly insecure. 6.9 is the current version.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

tunk
Posts: 1204
Joined: 2017/02/22 15:08:17

Re: touch command creates file one hour behind

Post by tunk » 2017/11/15 10:53:33

Some summer time setting?
Are you using NTP?
Edit: What's the output of hwclock?

jay.prakashinfo
Posts: 1
Joined: 2017/11/23 15:18:18

Re: touch command creates file one hour behind

Post by jay.prakashinfo » 2017/11/23 15:29:30

first create your system time zone and define the same zone inside this file.

edit this /etc/sysconfig/clock

ZONE="America/New_York"
UTC=false
And restart the rsyslog service then it's should work.

Thanks
Jay

Post Reply