问题标签 [crontab]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
7 回答
15900 浏览

django - Django 自定义命令和 cron

我希望每分钟执行一次我定制的 Django 命令。但是,在目录中完美运行python /path/to/project/myapp/manage.py mycommand时似乎似乎不起作用。python manage.py mycommand

我怎样才能做到这一点?我使用/etc/crontab

0 投票
9 回答
13116 浏览

django - 您如何将 cron 作业部署到生产环境?

人们如何将 cronjobs 部署/版本控制到生产环境?我对人们使用的约定/标准比任何特定的解决方案都更好奇,但我碰巧使用 git 进行修订控制,而 cronjob 正在运行 python/django 脚本。

0 投票
5 回答
3770 浏览

ruby - 通过 Capistrano 创建 crontab 而不是使用 crontab -e

我想在 Capistrano 部署文件中包含 cron 任务,而不是使用以下命令手动编辑 crontab 文件:

我可以在 Capistrano 运行命令中使用脚本来设置 crontab 的内容吗?

0 投票
4 回答
7113 浏览

ruby - Edit crontab programmatically and force the daemon to refresh

I'm trying to write a web frontend for Crontab in Ruby using the excellent CronEdit gem. I went through Dillon Cron's crontab source code and found that it updates a particular file so that the daemon will refresh the cron list during the next sweep.

In man crontab for VixieCron, it says:

Additionally, cron checks each minute to see if its spool directory’s modtime (or the modtime on /etc/crontab) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified. Note that the crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.

Is there any platform (Ubuntu, Red Hat, ArchLinux, Mac OS X) independent way to ensure that after manually editing the Cron file, the daemon refreshes it without fail?

0 投票
6 回答
8972 浏览

macos - 在 Mac 上开始使用 cronjobs

我正在尝试熟悉 cron 作业,并且我想我了解了基本概念(调度、语法等),但是,我似乎无法在带有终端的 mac 上正确使用它——我到底在哪里找到克朗塔布?我应该如何引用脚本的路径?

我想要做的是在远程机器上打一个 php 脚本(http://.. .) - 这可能吗?

0 投票
3 回答
1560 浏览

unix - crontab 报告在指定的开始和结束日期时间运行的内容

是否有任何工具或报告可以提供给定 crontab 文件可以输出在指定时间范围内运行的作业。

我们的 crontab 文件变得非常大,当我们在服务器上安排停机时间时,我们的系统管理员很难找出哪些作业需要重新运行。我们试图找出我们需要运行哪些作业。

我正计划编写自己的脚本,但想知道那里是否已经有什么东西了

0 投票
3 回答
2831 浏览

bash - 评估变量失败(w/Crontab)

这是我正在编写的用于记录 CPU 负载的 bash 脚本片段:

$ldsys当脚本以常规方式从控制台执行时,设置正确。它是金色的。这是问题:使用 crontab 执行时,$ldsys为空。

在过去的三个小时里,我一直在尝试数以百万计的东西来试图让这个东西工作......但我找不到任何东西。有没有人有任何想法?


笔记:

  • /usr/bin/mpstat 可以通过cron执行。我通过添加一个虚假任务来测试每分钟触发一次:/usr/bin/mpstat -P ALL >> somefile并检查输出。有用。

  • egrep, tr, 并且cut在 cron 下都可以正常工作。

  • 我认为它确实与 eval 分配约定有关......但我不知道为什么这会是一个问题,因为它是一个相对基本的构造......在尝试了亚当的建议之后,我现在不知道该怎么想......

编辑:去掉eval使用......仍然没有骰子。

0 投票
8 回答
7680 浏览

java - 在 Java 中定期调用函数

我们需要在 Java Web 应用程序中定期运行一个函数。如何定期调用某个类的函数?当某些事件发生时,例如服务器中的高负载等,有什么方法可以调用函数。什么是 crontab ?那是定期工作吗?

0 投票
3 回答
10618 浏览

php - Plesk 中的 Crontab

我正在尝试在 Plesk 中使用 crontab 运行测试脚本。php 文件只是通过电子邮件向我发送一条消息

我的 php 路径是 /user/bin/php

我在每个字段中都输入了 *,以使用以下命令每分钟运行一次脚本:

但是,该脚本未运行。

任何人都可以帮忙吗?

我可能遗漏了一些简单的东西,我以前从未使用过 cron。

任何建议表示赞赏。

谢谢。

0 投票
2 回答
4170 浏览

unix - 使用 crontab 执行脚本返回 127 错误代码

我在我的 UNIX 系统上手动执行脚本,它成功运行并更新了 ORACLE 数据库中所需的记录。但是,当我使用 crontab 执行相同的脚本时,我的进程以错误代码 127 退出。

进一步分析,我发现这些陈述存在一些问题。


LOGFILE=sachin ORALOGIN=abc/abc@abcd

cmd='sqlplus ${ORALOGIN} < SQLS >> ${SVC_HOME}/LOGFILES/${LOGFILE}。date +%Y-%m-%d';

评估 $cmd

请提出解决方案