跨平台流程管理工具

发布于 2024-07-11 09:10:30 字数 191 浏览 14 评论 0原文

我需要一个能够根据计划/配置启动一组进程的程序; 该程序将在后台运行并重新启动进程,以防进程崩溃。

Windows 和 Unix 上都有用于此类任务的标准工具 - 我需要的是一个跨平台程序,它可以使用相同的配置在不同的操作系统上运行。

任何实现基本功能(即创建进程、向进程终止事件发出信号等)的可移植 C/C++ 库也可以。

I need a program that is able to launch a set of processes according to a schedule/configuration; the program would run in the background and restart the processes in case they crash.

There are standard tools for this kind of task on both windows and unix - what I need is a cross platform program which could run on different operating systems using the same configuration.

Any portable C/C++ library which implements the basic functionality (i.e. create processes, signal process termination events etc) would be ok too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

固执像三岁 2024-07-18 09:10:30

您可能必须自己写。 它有很多令人讨厌的可移植性黑客,没有(真正的)光荣目的......即完成可以通过其他方式完成的事情的大量工作。

让某些东西在 *nix、*bsd 和 MacOS 上运行并不会太难。 制作/生成解析器来处理某种基于简单规则的配置文件不会太难。 添加最后的 Windows 香料将是一个巨大的痛苦。 然后你就去学习一些新的基于 Python 的构建配置系统,因为并不是每个 Windows 用户都有 cygwin 和 shell...然后你就去找人来帮助你发现 bug。

几百小时后,你会开始怀疑它是否真的值得写。 在 2 - 3 小时内,您可以使用 cygwin、ssh 和一些方便的 shell 脚本来很好地完成这项工作。

据说,大多数真正有用的程序都是程序员挠痒痒的直接结果。 所以..如果这是你真正需要并且有时间做的事情,我会说去做吧。 当然,它会变得相当受欢迎。 除此之外,由于上述原因,我怀疑这样的程序将在未来相当长的一段时间内保持未编写状态。

You'd probably have to write that yourself. Its a lot of icky portability hacks for no (real) glorious purpose ... i.e. a lot of work to accomplish something that could be accomplished via other means.

Getting something to work on *nix, *bsd and MacOS would not be too terribly hard. Crafting / generating a parser to handle some kind of easy rule based configuration file would not be too hard. Adding the final Windows spice to the mix would be a royal pain in the rear. Then off you go to learn some new Python based build configuration system since not every Windows user has cygwin and a shell ... then off you go finding people to help you find bugs.

After a few hundred hours, you'd begin to wonder if it was really worth writing. In 2 - 3 hours, you could have cygwin, ssh and some handy shell scripts doing the job just fine.

It is said that most really useful programs are a direct result of a programmer scratching a personal itch. So .. if this is something you really need and have time to do, I'd say go for it. Surely, it would become rather popular. Barring that, for the reasons above, I suspect such a program would remain unwritten for quite some time to come.

诗酒趁年少 2024-07-18 09:10:30

在所有这些平台上安装 ssh 服务器 并通过每个平台自己的方式处理进程的启动/停止怎么样?命令行工具?

为了能够在没有提示身份验证的情况下进行访问,我将使用无需密码的非对称密钥身份验证,以便从控制计算机立即访问所有受管理的主机。

所以我的解决方案是一个自制的解决方案,由一堆脚本(.bat 或 .sh 或您想要的任何脚本语言)和多个 ssh 服务器组成。

What about installing ssh servers on all those platforms and handle the start/stop of processes by means of every platform own command line tools?

To be able to access without prompt authentication I would use asymmetric key authentication without password so access would be immediate from a controlling machine to all the hosts managed.

So my solution would be a home-made one consisting of a bunch of scripts (.bat or .sh or whatever scripting language you want) and several ssh servers.

深海里的那抹蓝 2024-07-18 09:10:30

如果您愿意完全以 Unix 为中心,Cygwin 附带了一个可以在 Windows 上作为服务运行的 cron 版本。 然后,您可以在各个平台上使用通用的 crontab 文件。 请参阅http://www.noah.org/ssh/cygwin-crond.html。

If you're willing to go all Unix-centric, Cygwin comes with a version of cron that can be run as a service on Windows. Then, you could use a common crontab file across your platforms. See http://www.noah.org/ssh/cygwin-crond.html.

用心笑 2024-07-18 09:10:30

Golang 中的 cron 实现怎么样?

https://godoc.org/github.com/robfig/cron

它是跨平台的当您也需要时发出您的命令。 它作为一个小的可执行文件分发。 无需依赖。 它允许您添加 crons,但有趣的是,删除不是内置的。

How about a cron implementation in Golang?

https://godoc.org/github.com/robfig/cron

It's cross platform and issues your commands when you need it too. It distributes as a small executable. No dependencies necessary. It allows you to add crons, but funny enough, remove isn't built in.

supervisord 是一个用户空间进程管理器,用 python 编写,用于 unixwindows

supervisord 与 launchd、daemontools 和 runit 等程序具有一些相同的目标。 与其中一些程序不同,它并不意味着作为“进程 id 1”的 init 的替代品来运行。 相反,它旨在用于控制与项目或客户相关的流程,并且旨在像任何其他程序一样在启动时启动。

相关:在Windows上的cygwin上运行supervisord-unix(可能不需要windows版本的supervisor

supervisord is a userspace process manager, written in python, for unix and windows

supervisord shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.

related: running supervisord-unix on cygwin on windows (probably not needed with the windows version of supervisor)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文