Would it be possible/hard to write a version of 'at' that executes "right away" to get around ssh username=SYSTEM?

aputerguy nabble@kosowsky.org
Sun Nov 15 20:48:00 GMT 2009


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



More information about the Cygwin mailing list