使用 Windows PowerShell 作为批处理调度程序
我们有一系列夜间批处理作业作为 Windows 计划任务运行。他们的数量已经增长到开始互相踩踏的程度,因为批处理文件之间没有依赖关系,只有开始时间。我们正在考虑使用 PowerShell 编写脚本来控制夜间周期...任何人都可以确认我们正在做出正确的选择。有没有更好的方法来创建每晚批处理作业调度程序(除了购买产品),或者 PowerShell 是此类任务的推荐方法。
感谢您的回复。
We have a series of nightly batch jobs running as Windows Scheduled Tasks. Their numbers have grown to a point that they are beginning to step on each other since there are no dependencies between the batch files, just start times. We are considering the use of PowerShell to write scripts to control the nightly cycle...can anyone confirm we are making a sound choice. Is there a better way to create a nightly batch job scheduler (other than purchasing a product ) or is PowerShell the recommended method for such tasks.
Thanks for your response.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Powershell 将是一个合理的起点。您可以完全放弃 Windows 调度程序,并将 Powershell 脚本作为服务运行(使用 SRVANY.EXE 之类的东西)。甚至可能有一种“本机”方式让 Powershell 作为服务运行。
您的作业定义、依赖项、失败操作等可以以 XML 格式存储,Powershell 可以轻松读取。
我认为唯一的问题是调度所需的准确性,即:是否必须精确到秒?
PowerShell 有一些漂亮的作业执行 cmdlet,请参阅 start-job、get-job 和 receive-job。
Powershell would be a reasonable place to start. You could dispense with the Windows scheduler altogether and run a Powershell script as a service (using something like SRVANY.EXE). There may even be a "native" way of getting Powershell to run as a service.
Your job definitions, dependencies, failure actions, Etc., could be stored in XML format, which can easily be read by Powershell.
The only area I can see being an issue is the required accuracy of scheduling, i.e.: does it have to be to the second?
PowerShell has some nifty job execution cmdlets, see start-job, get-job and receive-job.
我认为 PowerShell 对解决调度和依赖管理的具体问题没有多大帮助。但这对于实际工作来说可能是个好主意。
对于日程安排,也许您应该查看免费的构建管理工具,例如 CruiseControl 或 Luntbuild。此类工具旨在处理许多作业的调度和依赖性管理。
I don't think PowerShell will help much with your specific problem of scheduling and dependency management. But it may be a good idea for the actual jobs.
For scheduling, maybe you should look at a free build management tool like CruiseControl or Luntbuild. Such tools are built to handling scheduling and dependency management for many jobs.