This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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
    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
	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:
Sent from the Cygwin list mailing list archive at

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]