how to cause linux system datetime to run faster than real world datetime?

JamesThomasMoon1979 asked:

Background
I want to monitor a running linux system over several days. It’s a custom gentoo build and with much custom software on board. This software has ongoing maintenance timers and cron scripts and other clock driven events. I need to verify these scheduled events are working.

Problem
Waiting for the system to step through daily and weekly activity is a long wait time. And modifying all clock-based timers on the system would be time consuming. Yet, I often want to test a system’s end-to-end scheduled activities without waiting a week.

Potential Solution
Have the linux system under test appear to run through it’s daily cycle of activity within just a few hours.

My Question for Serverfault
Is there a way to cause the system’s time to run faster than real world time?

My first thought is manipulating the ntp daemon to repeatedly and smoothly increment the clock . Any other ideas?

And yes, I know this may have strange side affects. However, the system has no important or time critical interactions with systems outside of itself. And this may be a valuable testing technique.

My answer:


Write a shell script that sets the system time and then waits for the results of the next job, then sets the system time again and waits for the results of the next job… Repeat until done.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.