The tag has no wiki summary.

learn more… | top users | synonyms

16
votes
3answers
2k views

Why is there a difference with Unix date between 2 and 3 months

How is this possible and how do I deal with it? I'm making backup script that is dependent on Unix date and have discovered an interesting bug: [root@web000c zfs_test]# date +%y-%m-%d --date='2 ...
9
votes
1answer
4k views

How do I make cron run every other Sunday on the OTHER Sunday?

I have a cron job that runs at 0 0 * * 0/2 -- i.e. every other Sunday. It just ran now, for instance. However, I want it to run on the other Sundays -- next Sunday, rather than this one. Another ...
6
votes
1answer
926 views

Time too quick in debian, 72 minutes pass in system date in one real world second

Having trouble with system date/time in GNU/Linux/Debian: Time goes too fast for date, time, cron. The sleep command works fine, file modification times are correct. The issue explained via commands: ...
5
votes
2answers
6k views

Calculate Days Since 1/1/1970

How can you calculate the number of days since 1/1/1970? This is for updating the shadowLastChange attribute on OpenLDAP. Is there a way to do this using the linux date command?
5
votes
3answers
230 views

Is an ntpdate correction atomic?

I've got the following in /var/log/syslog, from yesterday (July 30th) Dec 16 22:54:05 omap ntpdate[432]: step time server 91.189.94.4 offset 12052648.821465 sec ntpdate 91.189.94.4 "corrected" my ...
5
votes
4answers
3k views

How to determine number of week of the month

On the Linux CLI, is there a way to get the number of the week of the month? Maybe there is another way to get this with one simple (like date) command? Let's say that day 1 to 7 is the first week, ...
5
votes
1answer
809 views

Is it possible to set the date on a Linux machine to the year 2040?

I need to be able to set the date on Ubuntu (8.04.4 LTS) to the year 2040 (to test something that isn't relevant to this question). Is that possible? I can run: $ sudo date -s "15 JAN 2038 ...
5
votes
4answers
2k views

How to tell if a file is older than 30 minutes on AIX?

I'd like to write a shell script in ksh or bash which exits with 1 if a specific file is older than 30 minutes. (Last modification time is older than half hour). It would be easy on a Linux or a ...
5
votes
5answers
7k views

Cannot access client pc remotely due to time/date issue xp win2k3 environment — REMOTE solution please

When I run psexec to the user desktop (xp pro) I get "There is a time and/or date difference between the client and the server." I also get "access denied" when I run the at \clientname time ...
5
votes
2answers
199 views

date +%s glitches

I have a strange issue I'm starting to troubleshoot and wondered if anyone would have any helpful tips. I have a cronjob executed every minute that executes a script and appends the output to a file ...
4
votes
3answers
2k views

Why is my “Last log on” date wrong?

I'm sitting here across the office from Bob, who is logged into the domain right now, working away. I pull up AD Admin Center and take a look at Bob's account and it tells me his last log on date is ...
4
votes
5answers
6k views

ntpdate not updating system time in XenServer VM

We have a Debian webserver that I am trying to use ntpdate to keep the time in sync. When I run ntpdate ntp0.cs.mu.oz.au I receive 16 Sep 10:55:36 ntpdate[21626]: step time server 128.250.36.2 ...
4
votes
3answers
55 views

Docker Container time & timezone (will not reflect changes)

Where do Docker containers get their time information? I've created some containers from the basic ubuntu:trusty image, and when I run it and request 'date', I get UTC time. For awhile I got around ...
4
votes
2answers
10k views

date: cannot set date: Operation not permitted [duplicate]

I have received an interesting problem during I tried to set my Server time either with NTD or manually using date command. First of all I have tried to use NTD. I have succesfully installed the ...
3
votes
2answers
547 views

Question on date and timezone in Linux

I did the date command and it gave the following output root@localhost:~$ date Thu Dec 30 14:19:47 UTC 2010 Then i modified the date using date -s command whichn gave the following output ...
3
votes
2answers
3k views

Why is $ date still displaying EST when /etc/localtime is symlinked to /usr/share/zoneinfo/GMT?

I'm having a problem setting the date on my server... $ ls -la /etc | grep localtime lrwxrwxrwx 1 root root 23 Mar 6 12:07 /etc/localtime -> /usr/share/zoneinfo/GMT For some reason, although ...
3
votes
3answers
348 views

date -d: what are the accepted strings?

I am using the "date" command to perform some simple date arithmetic. The "-d" option lets me do this, but the man pages are very unclear on what is valid data. What are all the accepted options, and ...
3
votes
0answers
38 views

date command displays different time

I have one centos 5.8 Linux server. I am experiencing a bit strange issue and figured out it is something with system time. When I check date command, outputs are really strange. Here is example: ...
2
votes
2answers
1k views

Bash scripting: detect first day of month

I wrote three bash files: incremental_backup full_backup execution Now I want another bash script do the following : if (date is the start of month 1/-/----) then invoke `full_back_up` ...
2
votes
3answers
199 views

Changing linux date with current time

I am running sudo date +%m/%d/%Y -s 7/14/2010 command to change date. It changes fine except I want it to pick up the current time as well, and not start the time from 00:00:00 on 7/14/2010.
2
votes
1answer
1k views

Set up a permanent system date

I need to set up a permanent system date in a Linux test server for time-sensitive software which needs this time loop (Groundhog day's style) or bending time (Hiro's ones), you name it. I tried it ...
2
votes
4answers
12k views

How to create a yesterday date in a batch

copy \\server01\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy \\server02\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy ...
2
votes
1answer
210 views

Linux date translation to different time zone

The Linux server is hosted in EST timezone. But I want to translate the output of date command to IST(Indian Standard time +5:30 hrs) format and use it in a shell script. Is there any option available ...
2
votes
2answers
143 views

Display nth instance of grepped pattern

So here's my problem. I have an issue with a .csv file (Current.csv) in that there are commas randomly place throughout the data, so awk-ing the file doesn't give me constant column numbers for a ...
2
votes
2answers
72 views

bash: convert date from to unix timestamp changes timestamp

Running the following command at the xen-servers (either DOM0 or DOMU) at $company gives me a negativ number, on every other system zero (0) (even in my cygwin). date -d "1970-01-01T00:00:00" "+%s" ...
2
votes
1answer
91 views

Users changing date/time from BIOS

We have around 350 Windows XP PC and a Windows 2008 R2 Server. The problem is that some users are changing the date/time from BIOS and the next user who would try to log-in on that PC would get the ...
1
vote
4answers
1k views

cron job to remove files with specific name

I have this in my crontab 0 3 * * * mysqldump --host=10.100.100.3 --user=username --password=mypass --routines DBName | gzip > /tmp/mysqldumps/mydb.`date +"\%Y-\%m-\%d"`.gz now I need to create ...
1
vote
3answers
211 views

convert epoch time to readable time foramt

I wrote a code which convert epoch time to readable time sd=`date -d '1970-01-01 UTC '$SDATE' seconds' +"%d-%m-%Y"` the output is : 27-12-2002 but I want the output to be : 27/Nov/2002 how should ...
1
vote
3answers
2k views

Linux Centos 6.2 “hangs” until date is synchronized

I'm having a problem that i cannot understand why or how to solve it. I have a Centos 6.2 server, that's my secondary DNS (bind 8) and DHCP (ISC's dhcp server). I need to maintain an accurate date ...
1
vote
1answer
6k views

How do you set a DATE variable to use in a log for crontab output?

I was playing aroudn with some variations of date like DATE = $(date) but that didnt work either crontab -e CRONLOG=/tmp/log/crontab.log DATEVAR=`date +20\%y\%m\%d_\%H\%M\%S` * * * * * echo ...
1
vote
2answers
3k views

How do I set current Unix time in milliseconds?

Possible Solution date --set="2011-12-07 01:20:15.962" && date --rfc-3339=ns Original Question I can get the date with milliseconds like so: date +"%S.%N" date --rfc-3339=ns According ...
1
vote
3answers
886 views

Deleting all folders older than a specified date, except some of them

i had to do a script job in bash to delete all directory in a path which are older than a specified date except some of them. i know the name of the directories which shouldn't be deleted... Can you ...
1
vote
2answers
786 views

Convert SELinux log date format from Epoch to Normal

When SELinux logs an event to the audit log on my CentOS 6 system, it's logging it in epoch time which makes for a real hassle when trying to troubleshoot. Is there any way to make it log these events ...
1
vote
4answers
153 views

One Linux server has two timer

The time on one of our Linux box is very weird. Whenever I call date 3 times, the 4th call will give a wrong time(usually 1 hour later). I have setup cron to sync with ntp server. We have 20+ similar ...
1
vote
2answers
628 views

Server timezone changed to PHT but logs still written in MST?

A couple of days ago, I updated the timezone on an Ubuntu 12.04 LTS server using $ sudo dpkg-reconfigure tzdata. Today I noticed while tailing the mail log, that the times were still 15 hours behind. ...
1
vote
1answer
238 views

modification time of file in future, but timezone is set correctly

Files that I am creating at a Unix server are created with a modification time that lies 5 days in future. But when I check with the date command, it seems, that timezone and date are set correctly. : ...
1
vote
4answers
660 views

cron clock problem

I have noticed on my RHEL 5.5 that cron daily starts an hour later (at 1AM instead of midnight). System and hardware clock are the same. How can i set it so it will start at midnight? date [root@a ...
1
vote
2answers
937 views

Unable to set the date on a CentOS VM

The time on a Xen VM running CentOS 5 is incorrect. Running the date command seems to result in the expected output, but subsequent calls to date still show the incorrect time. [xxx@xxx ~]$ sudo date ...
1
vote
1answer
50 views

Why my date command changed and how to restore the default one?

I'm having a problem in a RHEL 5.3 after I tried installing Perl Power Tools. Everything was working fine until I tried installing that package by hand (the server has no access to internet). At ...
1
vote
2answers
613 views

ntpdate wrong date

Hi all I have an ubuntu8 server where I have problems with date. My current date (Europe/Rome) is 9:35 If I do date print me 11:12:34 I have seen my ntp.conf is: server 0.ubuntu.pool.ntp.org ...
1
vote
2answers
968 views

SFTP files not showing upload date as last modification time

Some of the files we receive on our Redhat server are showing date different from upload date as the last modification time. For us the modification time is important as we classify files depending on ...
1
vote
2answers
119 views

How to use date functions for linux batch specile?

First, I wasn't sure if belonged to StackOverflow or here, but figure this would be more applicable to server administration. We have a .tar backup file going to an offsite backup server each day as ...
1
vote
1answer
342 views

Apache RewriteCond: inject string into URI between regex match groups

EDIT This works, needed to use % in place of $ for capture groups: RewriteRule (.*) http://localhost:8081/%1/%{TIME_YEAR}1101%2 [P] Having a hard time sorting this out. Need a date string ...
1
vote
1answer
162 views

Log “date -s” command

I know that the date -s <STRING> command sets the time described by the string STRING. What i want is to log the above command whenever it is used to set the time into the file ...
1
vote
1answer
243 views

winscp filter by date

How to transfer files with WinSCP that are older than N days? It seems there is no such option inside. But could it be done with scripting/cmd mix?
1
vote
1answer
38 views

How to generate a signature with a launchd plist? [closed]

Is it possible to implement the following shell script completely as a launchd plist to generate a signature with timestamp in the StandardErrorPath / StandardErrorPath files? #!/bin/sh echo "Hi, ...
1
vote
0answers
241 views

Update clock on virtualbox virtual machine with cent os from host

I have a virtual machine, with cent os installed, and everytime I sleep the host computer, the clock of the VM goes out of sync. I would like it to pick up the current time from virtualbox - which I ...
0
votes
14answers
36k views

Finding day of week in batch file? (Windows Server 2008)

I have a process I run from a batch file, and i only want to run it on a certain day of the week. Is it possible to get the day of week? All the example I found, somehow rely on "date /t" to return ...
0
votes
2answers
76 views

System Date and httpd/mysqld

Hi when i change the date: date -s "01 Jan 2011 01:30:15" Do services such as mysqld and httpd need to be restarted for thier date to update? or is there a better way to handle these services date ...
0
votes
2answers
386 views

date keeps resetting

I have a virtual machine(VirtualBox) running Ubuntu server. When i issue date -s 2011-01-01 it changes the date, but after a few seconds, the date resets itself to the real time. I do not have any ...