简体   繁体   中英

How to ask a remote windows machine to automatically launch an application?

I have a windows server 2003 up in the internet. But sometime I need to restart it. After restart, I want one of the applications to run.

I want to do this all programatically. I can now remotely restart the server.

But the question is how can I ask that piece of software to be executed (more precisely, I want to execute a .BAT file to ask a tomcat to run)? Because I don't want to manually log in to the machine and start that application. That is time consuming. Is there any possible way, once the machine is started, my application will be run as well?

You can install Cygwin and then do it the same way we'd do it on a Linux box: via ssh , using keys .

OpenSSH is not part of the default Cygwin install, so be sure to select it. It's in the Net category.

Then, after you've installed Cygwin and sshd, read /usr/share/doc/Cygwin/openssh.README to learn how to set up sshd as a service, so it will answer requests automatically, without you having to start the ssh daemon manually.

Finally, set up keys, as described in the link above.

Part of the ssh protocol is a way to ask a remote machine to launch a program. Setting it up with keys lets you do it without needing a password.

If you're developing an application that should always be running on the server, you probably need to implement it as a Windows service. For C#, see the classes in the System.ServiceProcess namespace -- you will need to inherit from ServiceBase .

Alternatively, you can set the program to be run as a scheduled task on boot. See the Task Scheduler API to do this.

您可以尝试xCmd ,这是一个免费软件,可以在远程计算机上运行命令。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM