This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Would it be possible/hard to write a version of 'at' that executes "right away" to get around ssh username=SYSTEM?
- From: aputerguy <nabble at kosowsky dot org>
- To: cygwin at cygwin dot com
- Date: Sun, 15 Nov 2009 12:47:52 -0800 (PST)
- Subject: Re: Would it be possible/hard to write a version of 'at' that executes "right away" to get around ssh username=SYSTEM?
- References: <26362968.post@talk.nabble.com>
And in case anyone is interested, here is a bash function that launches a
command via 'at' at the next minute and returns the number of seconds until
the launch (actually if you are less than 5 seconds before the next minute,
it waits until the minute after so that at has time to setup - you could
probably use a number smaller than 5 seconds of course)
function at_launch ()
{
local h m s wait command
command=$@
set -- $(date +"%H %M %S")
h=$((10#$1)) #Note explicitly use base 10 so that 08 and 09 not
interpreted as bad octal
m=$((10#$2 +1)) #Advance minutes by 1
s=$((10#$3))
wait=$((60 - $s))
[ $s -gt 55 ] && let "m += 1" "wait += 60" # Make sure >5 seconds left
[ $m -ge 60 ] && let "m %= 60" "h += 1" #Overflow minutes
let "h %= 24"
at $h:$m $(cygpath -w $(which bash.exe)) -c \"$command\" > /dev/null
return $wait
}
--
View this message in context: http://old.nabble.com/Would-it-be-possible-hard-to-write-a-version-of-%27at%27-that-executes-%22right-away%22-to-get-around-ssh-username%3DSYSTEM--tp26362968p26363163.html
Sent from the Cygwin list mailing list archive at Nabble.com.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple