Jump to content

Linux Help - at command


SSD

Recommended Posts

I am trying to run some precise timings.  What I'd like to do is kickoff a process and then, precisely 10 minutes later, have a command run to gather performance statistics.  Then I can switch things around and repeat and have comparable results.

 

So I was playing with the "at" command.

 

If I run "at now + 1 minute", it will run on the next minute boundary - so if I start it at 12:00:50, it will run at 12:01:00, and not at 12:01:50 as I would have expected.  So the at command could wait between a second and a full minute depending on the seconds at the moment I run the command.  Am I missing something?  Is there a way I can use the "at" command to wait a specific period of time before running a command?  If not, any suggested alternatives?

 

Thanks for a quick response!

Link to comment

You could run a double at command.

 

Have your command wait to run the first command till the next full minutes, then another at command kicks off 10 minutes later.

 

Example:

 

Run command @ 12:01:35

 

Command waits to run until 12:02:00

 

Next command runs at 12:12:00

Link to comment

The lowest precision 'at' executes is on minutes. It knows nothing about seconds, so as far as it's concerned, your "12:00:50" is only "12:00".

 

The same is true for cron. It too knows nothing about seconds.

 

A hackish workaround is using 'sleep'. It takes a single argument which is the time duration. The default unit is seconds, but it can use minutes, hours, or days.

 

sleep 60s && command_to_invoke

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...