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.

1 Answer 1

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
3
  • +1 was about to hit post saying the same thing. Nov 2, 2009 at 19:35
  • I will check it, I did not think in the cron log. Working in haste is really bad. Thanks! Nov 2, 2009 at 19:36
  • There were a few things I miss: an extra asterisk in 'when to run' crontab section and, being a virtual machine, time sync guest-host was active. Thanks! Nov 3, 2009 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .