Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

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
share|improve this answer
    
+1 was about to hit post saying the same thing. –  3dinfluence Nov 2 '09 at 19:35
    
I will check it, I did not think in the cron log. Working in haste is really bad. Thanks! –  Dario Castañé Nov 2 '09 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! –  Dario Castañé Nov 3 '09 at 7:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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