Apache Timezone vs OS (Linux RedHat) Timezone - linux

Is there a difference between the timezone setting for the OS (a RedHat Linux build in my case) and the timezone for the actual Apache server on that OS? If so, which of the two am I seeing when I run date on the command line, and how can I change them individually? Thanks.

By default, the system-wide time zone should be the one you're seeing when running the date command. Apache should not, by default, have an additional time zone configured.
Software such as PHP, if you're running it, can have additional time zone settings (for PHP, it can be defined in the php.ini file via the date.timezone option).

Related

Automatically have a kickstart configuration assigned to a server

So I have about 5 different kickstart scripts. Each based on the type of server. I currently have to select which one when I PXE boot it.
Is there a way to have a PXE booted server automatically select the proper kickstart configuration script to use when it kickstarts?
I can set the menu.cfg to default and timeout to select a config, but I have to change it every time if a different type of server is needed to be configured. I have too many servers that do not have a virtual console in the iDRAC so I have to blindly PXE boot it with whatever default I have selected. But there are times where I'd like to kick multiple servers and not worry about the defaulted configuration on my kickstart server.

NodeJs timezone differs Linux timezone

I have a Linux server (CentOs to be specific) with npm installed. The server's timezone was UTC and I changed it to IRAN (+4:30).
Now my linux timezone is IRAN (say 7:00 PM) while my node Date() returns UTC (4:30 PM).
How can I change the default timezone of Node entirely (and not on a running applications)? I searched a lot and every answer I found was targetting node apps, not the node service in general. I want Node's timezone changed, not the app.
:( by the way, my CentOs does not have any GUI. Answers in text mode are welcome
I found the solution by trying different approaches.
First I changed the Timezone of Centos, and my application on pm2 was still on UTC timezone.
Then I changed the TZ var using cp /usr/share/zoneinfo/Asia/... and still no result.
Then I restarted my CentOs server excpecting the changes to take effect, but no result yet. After server was up, and pm2 reloaded my application, it was still using UTC timezone.
Finally I deleted my application from pm2, and then added it again. That was when my application started using the local timezone.
So keep in mind that no matter what you do to the "Linux TimeZone" or "TZ var", pm2 remembers the timezone of the moment you add your application, and keeps that somewhere and uses that as the timezone of your application.

How to create custom timezone with custom DST settings using an NTP server?

I have few NTP servers that I use with multiple platforms (Ubuntu, RHEL etc). I have many machines pointing to these servers and time is synced up as expected. I need to create a custom time-zone on the NTP server such that I am able to manipulate the DST settings for this timezone? I.e. need to have the ability to perform Spring/Fall DST on any specific date on as needed basis.
Is this even possible?
Interesting question - NTP has no concept of time zones [1] nor DST [2], that is down to the underlying OS/Subsystem.
NTP simply serves up the time & date in UTC.
Not sure what your usage case is - but you would need to either look at doing what you want at OS level, or simply running everything in sync to your own version of UTC. (As in you could have a closed time domain, serve the time from 1 server and manipulate it as you wish slow it down or speed it up etc.)
Agreed with every answer here. NTP server itself has no concept of time-zones. As pointed above, I was able to get the latest tzdata from their FTP repo. Manually edited the 'northamerica' file in VI to change the DST rules. Saved and compiled using zic. This link is also very useful.

System time and file system time are not the same

I met a strange problem on one cluster with 10 nodes.
On any node, any file operation makes the access/modification/change time of that file in the future that is 1min52s after the current system time obtained from date. That makes all make command cannot work correctly.
Following command are tested: touch X, echo 123456 > X, using utimes(X,NULL) and utime(X,NULL) with a C program. All of them can reproduce this problem.
Is there anyway to solve the problem? Thanks.
The usual way to address this is to synchronize the clocks on all of the machines to a common time reference using ntp (usually to a reliable time server). The NTP FAQ and HOWTO is a good place to start.
For most Linux servers, just installing the ntp package takes you halfway. You may need to customize the configuration file (usually /etc/ntp.conf), as well as enable the service for ntpd (the NTP daemon).

Logging client time drift on an ntpd server

I need to verify that a whole bunch of computers are within 50ms of ntp or nist time. Currently some are windows some are linux, and the windows machines are syncing with a domain controller that is pointed to ntp time, and each linux server is synced to a ntp pool server. Time does not seem to be a problem, but I need to prove it.
Any suggestions on methods to do this? I was hoping ntpd had some sort of logging capability, and that I could direct clients to query it and it then record the drift. I'd prefer it didn't act as authoritative time server, but just as a record keeper.
You could use a script to capture the values from ntpq and graph them in MRTG with RRD Tool.
The image below is taken from one of my Linux boxes - is that the sort of thing you are after? If you can provide some more info, and what OS the boxes you want to monitor are using I'll see if I can point you in the direction of the script I used, and provide some MRTG & RRD specific configs. My setup works on linux boxes only at the moment - and I've not had time to do any testing with Windows etc. If you where to adapt my solution to windows it would almost certainly require ntpd & ntpq rather than the standard Windows time client (as I don't believe you can get the sort of data you need from it).
Within ntpd.conf you can also enable statistics loopstats which will log data. You should check the ntpd documentation here for more info.

Resources