计划检查远程 Linux 服务器中的文件

发布于 2024-12-20 15:41:39 字数 995 浏览 1 评论 0原文

我需要检查远程 Linux 服务器中的预定作业的状态。通常成功会由 ${Taskname}_YYMMDDhhmm.ok 文件指示。因为每天会安排好几次作业,所以一个任务会有很多 ok 文件。

这些作业可以由其他远程计算机通过远程 shell 脚本初始化,也可以由 cron 初始化。

Example schedule:
Taskname   Scheduled_Start_Time
Task A  00:00
        06:00
        12:00
Task B  09:30  
Task C  **:30 (every 30 minutes)
Task D  09:30

所以我想制作一个快速而肮脏的程序,可以安排它通过远程服务器检查某些文件。我想安装它并使其成为我的 Windows xp 上的守护进程作为任务。您能推荐一些编程语言吗?

例如,我知道任务 B 和 D 每天只会运行一次,因此我可以在上午 11:30 之前检查它们的 ok 文件。我将配置我的程序,然后输入要检查的时间、要检查的文件(通过数据和时间的正则表达式)以及它应该位于的位置。请记住,它将位于远程 Linux 服务器上。

To sum up, the requirement for the programming language/tools:
1) it have library for scheduling some task
2) it can check a file's existence on a remote machine
3) it can be set as a daemon
4) it is okay with windows
5) (optional) After I list every scheduled tasks for this program, it can have a gui to indicate the job's status with some green/red color.

任何意见将不胜感激。谢谢!如果有一些现有的工具,我将非常感谢告诉我的人!

I need to check my scheduled jobs in remote linux server for its status. Usually the success would be indicated by a ${Taskname}_YYMMDDhhmm.ok file. Because the jobs were scheduled several times a day, so there would be many ok file for a task.

The jobs could be initialed by other remote machine by remote shell script, or they could be initialed by cron.

Example schedule:
Taskname   Scheduled_Start_Time
Task A  00:00
        06:00
        12:00
Task B  09:30  
Task C  **:30 (every 30 minutes)
Task D  09:30

So I would like to make a quick and dirty program which can be scheduled to check on some file over a remote server. And I would like to install it and make it a daemon as a task on my Windows xp . Would you please recommend any programming language?

For example, I know Task B and D would only run once a day, so I can check their ok file by 11:30am. I would configure my program and I would input the time to check, what file to check ( by regular expression on the data and time ) and where it should be located. Remember it would be on remote linux server.

To sum up, the requirement for the programming language/tools:
1) it have library for scheduling some task
2) it can check a file's existence on a remote machine
3) it can be set as a daemon
4) it is okay with windows
5) (optional) After I list every scheduled tasks for this program, it can have a gui to indicate the job's status with some green/red color.

Every opinions would be appreciated. Thanks! If there are some existing tool, I would really appreciate the one who tolds me!

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

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

发布评论

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

评论(1

温柔戏命师 2024-12-27 15:41:39

我建议使用 PHP。

  1. 您可以使用大多数标准 cron 守护程序上的 /var/spool/cron/crontabs/ 文件夹来管理 cron 作业。该文件夹中的每个文件均以创建该文件的用户名命名。
  2. PHP 支持 SSH 连接,因此您可以使用它进行连接并执行操作。无论是文件操作、重新启动守护进程还是其他。欲了解更多信息,请查看:http://php.net/manual/en/book。 ssh2.php
  3. 您可以轻松地将 PHP 应用程序设置为守护进程。事实上,您几乎可以将任何可执行文件设置为 Linux 中的服务:)
  4. PHP 是跨平台的,因此您从 Windows 机器上运行它不会遇到任何问题。
  5. 对于 GUI,您可以使用 php-gtk 扩展。我从来没有尝试过,但看起来还不错。
    有关详细信息,请查看 http://gtk.php.net/

I would recommend using PHP.

  1. You can manage cron jobs using /var/spool/cron/crontabs/ folder on most standard cron daemon. Each file in this folder is named after the username who has created it.
  2. PHP have SSH connection support, so you can connect and do you stuff using it. Be it for file manipulation, restarting daemon or something else. For more information, please check: http://php.net/manual/en/book.ssh2.php
  3. You can have PHP application set as a daemon easily. In fact, you can have almost any executable set as a service in linux :)
  4. PHP is crossplatform, so you wont have any issues running it from a windows box.
  5. For a GUI you can use the php-gtk extension. I've never tried it, but it seem okay.
    Check http://gtk.php.net/ for more information on this.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文