Showing posts with label no such device. Show all posts
Showing posts with label no such device. Show all posts

Saturday, December 15, 2007

Windows Services For Unix (SFU) Interix RSHD / REXEC and CMD.exe interoperability (no such device)

I thought I'd better post this as I've just spent a good few hours banging my head against my keyboard trying to get a batch file to execute (i.e. via CMD.exe) on a Windows box running SFU Interix RSHD via RSH from a BSD box.
No matter what I tried I was getting "no such device" errors, in the end I figured it was down to the file descriptors (i.e. stdin/out/err).
So if you want to execute a windows command/batch file (via CMD.exe) via Interix RSH daemon:-
(unix land)
$ rsh "runwin32 <windows style path to exe/bat> </dev/null | cat"

e.g.
$ rsh x0 "runwin32 e:\wrcheck\wrcheck.bat </dev/null | cat"

What this does is re-direct stdout/stderr via the pipe so you see the output via cat, stdin is redirected from /dev/null, obviously this can be changed to suit your individual needs.
You could of course also redirect stdout/err seperately via >stdout.txt 2>stderr.txt.

I hope this saves someone a headache :)