Does anyone know an elegant way to initiate a bash script (to run on a linux box) from a windows service written in C#?
I can only think of some combination of putty doing auto-login and automatically running a command upon login.
But this seems clumsy and a bit insecure.
Security doesn’t need to be very high as both boxes reside on the internal LAN inside the corporate firewall.
And only sysadmins can login to the windows box.
You can use SSH with key authentication to run a command without having to enter or store a password in your application. You have to enable key authentication in the Linux SSH server (follow instructions here to create and store the key in the appropriate location on the server) and then you can run
in your application via Process.Start()
plink is the command line utility which comes bundled with PuTTY.
EDIT: If you don’t want PKI (which may not be a good idea, but you know your environment), you can setup a rsh server in the linux box and send the command via rsh (Cygwin’s rsh might work better with linux boxes)