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
3k 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
897 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
3answers
224 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
713 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
2answers
196 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
5answers
543 views

User creation on Linux Redhat

Is there anyway one can determine when a user was created on Linux? I know of a couple of things one can do,but it's an unreliable way of doing it. The first option is checking when the home directory ...
4
votes
2answers
7k 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
5k 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?
3
votes
2answers
497 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 ...
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
197 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
9k 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
3answers
321 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 ...
2
votes
2answers
134 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
1answer
88 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
202 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
3answers
834 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
1answer
174 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 ...
1
vote
1answer
4k 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
561 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
151 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
445 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
205 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
2answers
920 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
2answers
510 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
1answer
716 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
308 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
157 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
234 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
34 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
139 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
13answers
32k 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
75 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
326 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 ...
0
votes
2answers
2k 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 ...
0
votes
1answer
62 views

Incorrect file creation/modication time in linux

In our server we get files uploaded daily by customers via FTP. However sometime the the time stamp of these appear incorrect even though the server time is correct. I got a file with time stamp Jun ...
0
votes
2answers
63 views

Is there a way to set the date on a server from the date from another server?

Someone asked me to update the times on 4 servers that are not connected to the internet and they have no ntp server. e.g /etc/hosts 146.92.25.3 jollibee 146.92.25.4 mcdonalds ...
0
votes
1answer
204 views

setting logrotate to use UTC time

Is it possible to force logrotate to use UTC time for one configuration? I need the dateext to be set to UTC. I was hoping it was as simple as setting a date varible. Should I just run postrotate and ...
0
votes
5answers
271 views

Find all files recursively by a certain date

My site is compromised by an FTP brute attack and the cracker modified / created some files in my home directory. Let's say the date of the malicious creation / modification is 2011-4-5 21:38:09. ...
0
votes
2answers
253 views

System reboot on executing “date -s” command

My system reboots when i give the "date -s" command. I collected the log and it says this Jan 18 13:27:46 watchdog[2421]: file /tmp/cmm/strobeWDT was not changed in 1 seconds. Jan 18 13:27:46 ...