[CentOS] the at command

Tue Jan 22 04:38:59 UTC 2013
Alfred von Campe <alfred at von-campe.com>

On Jan 21, 2013, at 16:46, Jerry Geis wrote:

> So I thought - hey in my program "I can send a command out that I want 
> to run - this command is also another program of mine, get the current 
> time, add 5 seconds to it, send this time HH:MM:SS
> to all 10 boxes and "schedule" an "at" command to run at that time.

Here is a crude shell script that should accomplish what you want.  It
is crude because it will break if you run it around midnight and does
very limited parameter and no error checking.  But if you pass it the
time in the format HH:MM:SS followed by the command you want to run,
it will start the command at the specified time.

#!/bin/sh

start=$1
shift

if [ "$(date +%T)" < "$start" ]; then
    echo "It's already after $start"
    exit 1
fi

while [ "$(date +%T)" != "$start" ]; do
    sleep 0.1s
done

echo "Starting command at $start"
eval $*


Alfred