Questions tagged [date]

the "date" tag is used to classify questions about date/calendar/time manipulation, visualisation, conversion... on Unix-like systems.

2
votes
2answers
718 views

Make date change permanent in EC2

How can I manually set date and time to future in EC2 instance and make it permanent, so it won't reset after reboot ? I can change date using this command: $ sudo timedatectl set-time "2017-12-09 ...
1
vote
2answers
62 views

Printing a dynamic list of month days vertically

I need to write few line in a code that I use in my study, and I really gave up! currently, i can list the days of a month and the equivalent day number but I can't link this to the system clock so it ...
1
vote
2answers
481 views

Setting old system date

I have a Centos 7 server running in a cloud-server provider (ProfitBricks). I need to setup a demo system but is really hard to create daily fake data. My idea is to configure this server with an old ...
1
vote
2answers
789 views

How to get proper format from date for the touch -A argument?

I would like to change all of the attribute times of some files to the immediate date. It appears that I would need to use touch -A * (more or less; realizing that I am going to use a more complex ...
3
votes
1answer
3k views

I'm trying to compile alsa-driver-RTv5.18 but get date-time error for gcc 4.9.2

/home/user/Downloads/Rt-Linux-HDaudio-5.18/alsa-driver-RTv5.18/alsa/acore/info.c:1065:22: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time] "Compiled on " __DATE__ " for ...
2
votes
1answer
705 views

Invalid time on FreeBSD

Problem My FreeBSD is always 2 hours behind when I'm offline although my BIOS clock shows the UTC time and my time zone is set to CET in /etc/localtime. I'd like FreeBSD to look at the clock in BIOS,...
1
vote
1answer
39 views

Calculate difference in numbers and save in colon-separated time format with bash script

I have a tab-separated file, e.g., 0018803 01 1710 2050 002571 0018951 01 1934 2525 003277 0019362 02 2404 2415 002829 0019392 01 2621 2820 001924 0019542 01 ...
1
vote
1answer
556 views

In crontab, can I specify a number of days before the end of month?

I want to run a script that generates a weekly report every Saturday night at 11 PM, and another script that generates a monthly report on the 1st of each month. I don't want the weekly report to run ...
0
votes
1answer
15 views

Builroot date is wrong

When I flash a buildroot image for the raspberrypi3 using the date command will give me 1970-01-01. I have to manuel reset that every time. What would be the correct way to handle this, should I ...
0
votes
1answer
46 views

15 min interval rounded parameter as starting and ending time in a specified format

I wanted to pass parameters in a shell script which calls a java program... For example the current time is 2011:02:23 01:05 then I need to floor to nearest whole time like 1:00 (starttime parameter ...
0
votes
1answer
331 views

date - how to get next weekday (ignore weekends)

I'm setting up a cron job to suspend and wake a server at certian times. I'm using two commands. One to be run from mondays to thursdays: rtcwake -m mem -t $(date +%s -d "08:00") And another one to ...
0
votes
1answer
47 views

get date in thunderbird message via Dolphin send-to

I have successfully created a working desktop file that send (one or more) attachments to thunderbird, with from, to fields and with, as a body, a file html. This is the file content: [Desktop Entry] ...
0
votes
1answer
318 views

mtime - Set date format

Looking over the manual, I can't figure out how to set the date format. I am using the following to locate folders that are in 'dd-mm-yyyy' name, but realise that it may not be working due to the ...
0
votes
1answer
38 views

Does the time field in a csv exported nagios XI State History Report represent the last time a service was checked for that time period in the report?

I've done an export of the State History Report in nagios XI to export to a CSV for a specified time period. I get back the fields time, host, service, statechange, statetype, currentattempt, ...
0
votes
1answer
77 views

Zypper: Check last “zypper up” command time

There is a script that checks whether packages up-to-date or not via a zypper up. In this situation, team "A" creates the servers: they do zypper up, ok. Another team validates the servers: they ...
0
votes
1answer
189 views

Change date on an OpenVZ VPS

I have a cheap OpenVZ VPS, and I noticed the time is a lot wrong. Each time I try: ntpdate -s time.nist.gov it silently returns as if it was successful, but nothing changes. When I do: date -s 11:...
0
votes
1answer
76 views

get number of lines which has particular record from last hour log

I need to get number of lines which has particular record from last hour log . log record looks like this. 09:28:03.155 [pool-2-thread-1030]-Rcvd msg {src='90000000',dst='101',msg='2500FREE',trxId='...
0
votes
1answer
317 views

auditd script through crontab - bad date

I did create a central auditd server where i'am sending all audit logs form local servers. I would like reports accesses from a specific node. So I created a simple report sript where one line is ...
0
votes
1answer
295 views

Suse Linux, slowing down system time to in sync with time server

Normally is the time of a Linux server (due to ntpd) in sync with the time server. However the ntpd is running but server is now running 20 seconds ahead. How do I slowdown the server little by little....
0
votes
1answer
496 views

AIX: Why does the timezone differ when using su or in crontab?

3:root@SERVER:/root # cat wtf.sh echo "date" date echo "su - root -c date" su - root -c date 3:root@SERVER:/root # 3:root@SERVER:/root # ksh wtf.sh date Wed Nov 9 13:15:01 MEZ 2016 su - root -c ...
0
votes
1answer
1k views

After rebooting date are getting changed in centos7

In centos7, I don't know why the date are showing different timestamp. When I modified according to my need and rebooted the machine, it is getting reset. Tried most of the options as I got in ...
0
votes
1answer
2k views

view IPs from apache access.log for date period

I have seen someone use this command -- and it works where it pulls back all the IPS in a list/group: cat access.* | awk '{ print $1 }' | sort | uniq -c | sort -n However, I want to choose the past ...
0
votes
1answer
56 views

How to implement config file expiration time?

I have a Debian server which runs a service using multiple config files (in a similar way to apache2) which I need to add an expiration date to. The config file that has an expiration date starts with ...
0
votes
1answer
230 views

How to see the lines whose date column is less than x day from today

My file ID=29524 02/12/2015,23:59:34,'PAt, 0, ID=29628 02/12/2015,23:59:37,'PAb, 1.9, ID=30816 03/12/2015,00:00:20,'PAc, 4.15, I would like to print files with X days less than from today. My try ...
0
votes
1answer
110 views

Issues with storing an echo of a date conversion into a string variable inunix

Apologies but this question comes from a question previously raised: How can I convert a local date-time into UTC date-time? Toby has been absolutely great helping me with some conversion string-->BST ...
0
votes
1answer
863 views

Modify date in email header using script with mailx

I am trying to modify a script which grabs data from a database and puts it into the message of an email which is then sent out using mailx. What I need to do is grab the date which is in the first ...
2
votes
0answers
35 views

One-liner to convert and adjust a specified time in FreeBSD

It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"), and easy to adjust a date with the same command (date -j -v+1y "...
2
votes
0answers
811 views

“export TZ=`date +%Z`” leads to confusing output of “date”

I recently noticed the following (strange) behavior: user@pc:~$ date Mi 21. Jun 12:03:10 CEST 2017 user@pc:~$ date +%Z CEST user@pc:~$ export TZ=`date +%Z` user@pc:~$ date Mi 21. Jun 10:03:30 ...
2
votes
0answers
287 views

ISO8601 time everywhere?

I would like to have my dates and times shown in ISO8601. I have been unable to find a locale which supports that and which does not cause other programs (e.g. perl) to go berserk. Which locale ...
2
votes
0answers
5k views

How do I set the correct time on Centos 7?

I have the minimal install of Centos 7 on my PC (not virtual box). I have spent the last few hours trying to figure out how to set up the correct time. I am still fast by one hour. After spending ...
1
vote
0answers
86 views

Faketime lib on Mac not always works

Installed libfaketime with brew, latest version 0.9.7, then did following steps as described in README.OSX: export DYLD_FORCE_FLAT_NAMESPACE=1 export DYLD_INSERT_LIBRARIES=/usr/local/Cellar/...
1
vote
0answers
480 views

Getting a range of lines between timestamps from /var/log/messages

I want to get all lines between two timestamps from /var/log/messages. I only have start time which I provide to my script as input. The script then should get me all the lines till next day as output....
1
vote
0answers
88 views

rtcwake being set one day ahead of intended time

I am trying to use this command to wake up my computer 5 seconds from now: sudo rtcwake -m no -s 5 The problem I am having is that the time to wake my computer is set 5 seconds ahead of current time ...
1
vote
0answers
66 views

Compare file dates from two directories

I have two directories with files with the same name. Basically I want to replace dir1/file.txt with dir2/file.txt if the creation date of dir1/file.txt is more recent. But i think I'm missing ...
1
vote
0answers
73 views

How to track leap second change after it happened?

I had applied a patch from Redhat on this machine to automatically correct the leap second change by inserting an extra second at the time of leap second change. Now, I want to see its effect. Of ...
1
vote
0answers
92 views

Cron running tasks at second 26?

I've many vps with the same cron task sending data with curl every minute, e.g. date command output. So I'm receiving datetime from every vps and I just realized that one of them is running the cron ...
1
vote
0answers
206 views

How to change the date format in the LXDM login/greeting screen (LXDE)

I found a number of resources to change the system (Archlinux 2016-03-01) date format, amongst others one to create a new format from an existing locale file. I then modifed /etc/environment and ...
1
vote
0answers
69 views

date/time setting does not work after unplugging power adapter or sudden power cut

For some reason, I want to configure the date/time in my Linux (CentOS 6.5) to be different from the REAL date/time, but the setting won't work if I turn my computer(desktop not laptop if this matters,...
1
vote
0answers
1k views

Changing the date format of auth.log

I was looking to change the date format in which auth.log logs information. I could not find a way to do it. Is there a method to do this? My system uses rsyslog.
0
votes
0answers
30 views

Comparing Timestamps

My users sometimes get alerts with a timestamp, (from another system, via email) but no hostname. I want to give them a function that can compare timestamps in my system that's designed like this: /...
0
votes
0answers
58 views

Automatically terminate lost SSH sessions

Sometimes when I'm on a sketchy internet connection like an airplane, my ssh session drops suddenly. When this happens, I want the sshd server to automatically kill the session after a few seconds, ...
0
votes
0answers
18 views

Rewrite files last modified date

I have a folder of contents which I wish to archive. Each file has a different last modified date. Is there a way to change the last modified date of all the files to a specific one from the past? I ...
0
votes
0answers
22 views

Buildroot date is set to Jan 1, 1970

why does buildroot automatically set the date in the title. And how do I fix that? Or do I have to make a script to manually set that?
0
votes
0answers
129 views

SFTP the latest file

I need to sftp to a remote server, find the latest file on the server, download the file, and rename the file so it's not used again. I have no control over the file naming convention, so I need to ...
0
votes
0answers
34 views

grep text with dates 30 days older within a file and move to another file

unix script to grep text with dates 30 days older than current date within a file and move to another file without having to manually input the current date should be the system date automatically in ...
0
votes
0answers
75 views

Permanently adjusting RHEL 6 timezone remotely

We have a collection of cards running RHEL 6. We would like them to boot such that their timezones are Zulu (UTS, GMT, GMT-0). I have read and tried many of the suggestions out there that supposedly ...
0
votes
0answers
100 views

Search for Date and Time in Log relative to system time - within 10 minute window - Confirming Log is running

I'm trying to figure a way to monitor one of our log files. A cron job runs every 5 minutes which outputs the following line in a log file: 02-16-17 18:40:01 I'd like something akin to cat log | ...
0
votes
0answers
459 views

TIMEZONE set for specific country but we get UTC Time - how it can be?

I have Linux red-hat 6.6 version This machine was set for Israel time zone as the following # more /etc/sysconfig/clock ZONE="Israel" ls -ltr /etc/localtime lrwxrwxrwx 1 root root 23 Jul ...
0
votes
0answers
395 views

Reset time / date to current time-zone using timedatectl preferably, or date

I'm looking to reset the current system time to the selected time-zone using the timedatectl preferably, or date command. This is on the CentOS 7 OS, hence the timedatectl preference. I'm in need of ...
0
votes
0answers
140 views

reading dates from process substitution using awk. Issue with field separator, splitting tokens incorrectly

I have the following code, thanks to @Janis for the help with the process substitution. Also, apologies for creating a new question, I haven't received any recent replies on the thread of my previous ...