touch command creates file one hour behind

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

touch command creates file one hour behind

Postby 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
Forum Moderator
Posts: 21183
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: touch command creates file one hour behind

Postby 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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

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

Re: touch command creates file one hour behind

Postby 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

Postby 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