Darkness Fish Posted March 4, 2005 Posted March 4, 2005 Basically, what I'm trying to do, is write a basic scheduler to use cygwin's scp utility to copy files to a Unix box. I have a console application which accepts a file path as a parameter, and calls cygwin's scp.exe to transfer the file. If I call this console application from the command line, or a dos-prompt, the file transfers succesfully, without need of interaction, as I have the id_dsa keys correctly set up. If I call this console app from a Windows service, which runs under my domain account, the process accepts the parameter correctly, launches the scp utility, but never completes. Debugging the console application by writing to a text file, I can see that it gets as far as the Process.WaitForExit() statement, and never returns Does the Windows service not have all my environment variables and paths? Is there any reason why the process should run differently, when called from a Windows Service, as opposed to from the command line? Cheers for any help, it's driving me absolutely insane. Quote
mskeel Posted March 4, 2005 Posted March 4, 2005 By windows service you mean .Net app? Why not just write the utility in Perl or something with a little less overhead? I assume you are writing this for the purpose of automating a mundane or repeatative process? Is there a cron for cygwin? Quote
Darkness Fish Posted March 4, 2005 Author Posted March 4, 2005 By windows service you mean .Net app? Why not just write the utility in Perl or something with a little less overhead? I assume you are writing this for the purpose of automating a mundane or repeatative process? Is there a cron for cygwin? Yeah, it's a .Net App, written in C#. I'm recording data in an Oracle Database at the same time, using a set of standard classes we already have. That's why it'd be really handy to do this in a Windows Service. Quote
mskeel Posted March 4, 2005 Posted March 4, 2005 What happens if you substitute the cygwin command for a native command like ping or something? Do you still have the hang? I've called programs from the windows command line before, but is there a difference when calling in a cygwin window (I use bash on on cygwin for example)? Is it possible the service is skipping some kind of setup file like a .cshrc or .login in your cygwin prompt? What happens when you run the program via the cygwin prompt as opposed to within visual studio? Quote
Darkness Fish Posted March 4, 2005 Author Posted March 4, 2005 I've just tried it with "ping" rather than the scp command and that works fine, there's practically no hang, it exits succesfully. I've also outputted all my envronment variables to a text file, and tried calling my SCP console app via command line and a windows service, and all environment variables are the same. I'm pretty new to cygwin (in fact, I'm pretty new to .Net too), I'm kind of using a big hammer here, due to impending (ridiculous) deadlines, so I'm not sure about any cygwin config files. It looks like it's likely to be something to do with cygwin it's skipping over, I'm going to have to do a bit more investigation. Cheers for the help so far. To be continued Monday. Possibly. Quote
Administrators PlausiblyDamp Posted March 14, 2005 Administrators Posted March 14, 2005 (edited) Downright bizarre suggestion but at the very bottom of this page it suggests running ssh from a batchfile (no reason given mind :confused: ). Try creating a batchfile to run the ssh / scp and call that from your service. Might be interesting to see if that fixes anything. Edited May 11, 2005 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.