[CentOS] timeout vs. winexe

Mon Jul 16 21:11:56 UTC 2012
Les Mikesell <lesmikesell at gmail.com>

I use the winexe (a samba-based tool like psexec) to run a command
remotely on windows targets.  The problem is, sometimes it hangs until
interrupted and I'd like to put it in a cron job.   So I added a
'timeout 80' on the command line that starts a shell script that
invokes winexe with the needed parameters.  This does prevent the
hang, but now every run takes the full 80 seconds to return where it
should average 5 or 10 seconds on a normal execution - and it seems to
trap normal interrupts until its own timeout is reached.

Timeout seems to return immediately when other commands exit.  Am I
missing something obvious that might make it wait in this scenario?

Strace show a loop of these filling the time after I think it has completed:
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig -icanon echo
...}) = ? ERESTARTSYS (To be restarted)
--- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
--- SIGTTOU (Stopped (tty output)) @ 0 (0) ---

-- 
   Les Mikesell
     lesmikesell at gmail.com