1

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 date ("2016-01-01" as an example).

First problem each time I restart the server the date is updated even though there is no NTP client installed.

Second one, the most important. After I manually change the date using:

$ timedatectl set-time "2016-01-01 12:00:00"

After some minutes I'm not able to see the server (ssh or http). I have restarted the firewalld service and the sshd service, both show status as running.

Any advice?

  • 1
    1) traveling backward in time is not a good idea. 2) it looks like system is getting time from a hardware clock, have you try to set it ? – Archemar Jun 27 '16 at 11:19
  • two questions, so it should be written as two different U&L questions – Giacomo Catenazzi Jun 27 '16 at 12:53
0

If you want files to have a modification date in the past, you can just use the touch command. Depending on what you want to demo, this might already be sufficient. Since your actual requirements are not really clear, it's hard to tell whether changing the system clock with all the associated hassle is a reasonable approach.

0

You can fake the time for most applications with the aptly named faketime. Run faketime 'yesterday' myapp to make myapp believe that it's yesterday. Faketime works by intercepting library calls made by the application. It only works with dynamically-linked applications, but that's usually good enough.

Your server is probably taking the time from the hypervisor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.