访问远程计算机以启动Python脚本而不打扰用户
首先,我承认这是交叉发布在SuperUser但是我决定也在这里发帖,因为我的目标与编程相关,并且这个社区可能有比我正在考虑的更好的解决方案场景。
我有一台充当媒体中心的 Windows 7 计算机,因此它始终处于开启状态,但并不总是处于使用状态。我希望能够远程登录到这台机器并启动一些需要时间计算的 Python 脚本。
我使用 dropbox 同步脚本及其输出。如果我使用远程桌面,我可以获取桌面视图并使用它,但媒体中心视图被阻止(我看到登录屏幕)。如果我使用 LogMeIn,媒体中心应用程序将关闭(与远程使用不兼容),并且远程和媒体中心视图相同。
有没有一种方法可以远程访问计算机来启动和监控这些Python脚本的执行,同时又不打扰媒体中心用户?
First, I'll admit this is cross-posted at SuperUser but I decided to also post here as my objective is programming related and this community might have better solution scenarios than just the one I'm thinking of.
I have a Windows 7 computer that is acting as a Media Center so it is always on but not always in use. I would like to be able to log in to this machine remotely and launch some Python scripts that take time to compute.
I sync the scripts and their output using dropbox. If I use Remote Desktop I can get a view of the desktop and use it but the media center view gets blocked (I get the log in screen). If I use LogMeIn, the media center application closes (not compatible with remote use) and both the remote and media center views are the same.
Is there a way to access the computer remotely to launch and monitor the execution of these Python scripts while not disturbing the media center users?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如何将其执行包装在 远程 WSH 中?不确定监视部分,尽管我想您可以简单地让脚本在远程计算机上创建日志,然后您可以在远程脚本仍在运行时实时“跟踪”它......
How about wrapping their execution within Remote WSH? Not sure about the monitoring part, although I suppose you could simply have your scripts create a log on the remote machine, and then you can "tail" it in realtime while the remote script is still running...
对于运行远程 python,我喜欢 execnet。它为您提供了在任何“ssh”可连接上运行代码的选项,或者如果您在本地网络上运行代码引导脚本 您可以在连接计算机上运行(请小心,因为如果您打算从其他地方连接,这是不安全的)
我会运行 openssh 并使用 execnets ssh 连接器。您可以创建通道,以便将脚本的结果发送回给您。
设置起来并不困难,一旦完成,您将来就有很大的灵活性,即将您的脚本分发到更多的机器上。
For running remote python I like execnet. It gives you the option of running code on any "ssh"able connection or if you are on a local network a little bootstrap script you can run on the connecting machine (be careful as this is not secure if you intend to connect from elsewhere)
I would run openssh and use execnets ssh connector. You can make channels so the results of the scripts get sent back to you.
It not that difficult to setup and once you do you have lots of flexibility in future, i.e distributing your scripts on many more machines.
进一步搜索得到了这个,它准确地解决了使用媒体中心和远程连接的问题:
http://www.missingremote。 com/index.php?option=com_content&task=view&id=3692&Itemid=232
Further searching yielded this which exactly addresses using Media Center and remote connections:
http://www.missingremote.com/index.php?option=com_content&task=view&id=3692&Itemid=232
我使用 psexec 在 Windows 计算机上运行远程命令。
I use psexec to run remote commands on Windows machines.