Re: the at command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux