2

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 with a cron at 00:00 every day that invokes date to set the desired date. No success.

As a side note, in Ruby it is possible in code but I need it system-wide.

Dario Castañé
  • 155
  • 1
  • 2
  • 7

1 Answers1

7

Using the date command makes sense to me, do you have any errors in your cron log? Is the cron job being run as the superuser (required to change system time). Maybe post the cron job so we can troubleshoot it?

Also, make sure ntpd is not running and resetting the clock after you change it:

/etc/init.d/ntpd status

Also, make sure ntpd doesn't start at boot:

For Redhat/Centos Family:

sudo chkconfig ntp #Maybe ntpd

If you see numbers than:

sudo chkconfig ntpd off

For Debian:

ls /etc/rc*.d/*ntp* #To check
update-rc.d -f ntp remove #to remove
Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448