你如何在 Windows 上的 Cygwin 中运行 crontab? [英] How do you run a crontab in Cygwin on Windows?

查看:31
本文介绍了你如何在 Windows 上的 Cygwin 中运行 crontab?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些 cygwin 命令是 .exe 文件,因此您可以使用标准的 Windows 调度程序运行它们,但其他命令没有 .exe 扩展名,因此不能从 DOS 运行(看起来像).

Some cygwin commands are .exe files, so you can run them with the standard Windows Scheduler, but others don't have an .exe extension so can't be run from DOS (it seems like).

例如我希望 updatedb 每晚运行.

For example I want updatedb to run nightly.

如何让 cron 工作?

How do I make cron work?

推荐答案

您还需要安装 cygrunsrv 以便您可以将 cron 设置为 Windows 服务,然后运行 ​​cron-config.

You need to also install cygrunsrv so you can set cron up as a windows service, then run cron-config.

如果您希望 cron 作业发送任何输出的电子邮件,您还需要安装 eximssmtp(在运行 cron-config.)

If you want the cron jobs to send email of any output you'll also need to install either exim or ssmtp (before running cron-config.)

请参阅 /usr/share/doc/Cygwin/cron-*.README 了解更多详情.

See /usr/share/doc/Cygwin/cron-*.README for more details.

对于没有.exe 扩展名的程序,它们可能是某种类型的shell 脚本.如果您查看文件的第一行,您可以看到您需要使用什么程序来运行它们(例如,#!/bin/sh"),因此您也许可以从Windows 调度程序通过调用 shell 程序(例如,C:cygwininsh.exe -l/my/cygwin/path/to/prog".)

Regarding programs without a .exe extension, they are probably shell scripts of some type. If you look at the first line of the file you could see what program you need to use to run them (e.g., "#!/bin/sh"), so you could perhaps execute them from the windows scheduler by calling the shell program (e.g., "C:cygwininsh.exe -l /my/cygwin/path/to/prog".)

这篇关于你如何在 Windows 上的 Cygwin 中运行 crontab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆