1. <small id='NehWM'></small><noframes id='NehWM'>

    <tfoot id='NehWM'></tfoot>
    1. <i id='NehWM'><tr id='NehWM'><dt id='NehWM'><q id='NehWM'><span id='NehWM'><b id='NehWM'><form id='NehWM'><ins id='NehWM'></ins><ul id='NehWM'></ul><sub id='NehWM'></sub></form><legend id='NehWM'></legend><bdo id='NehWM'><pre id='NehWM'><center id='NehWM'></center></pre></bdo></b><th id='NehWM'></th></span></q></dt></tr></i><div id='NehWM'><tfoot id='NehWM'></tfoot><dl id='NehWM'><fieldset id='NehWM'></fieldset></dl></div>
      <legend id='NehWM'><style id='NehWM'><dir id='NehWM'><q id='NehWM'></q></dir></style></legend>

      • <bdo id='NehWM'></bdo><ul id='NehWM'></ul>

      如何每X分钟运行一次cronjob?

      How to run a cronjob every X minutes?(如何每X分钟运行一次cronjob?)
    2. <legend id='p1S3x'><style id='p1S3x'><dir id='p1S3x'><q id='p1S3x'></q></dir></style></legend>
        <bdo id='p1S3x'></bdo><ul id='p1S3x'></ul>

          <tbody id='p1S3x'></tbody>

            1. <small id='p1S3x'></small><noframes id='p1S3x'>

            2. <tfoot id='p1S3x'></tfoot>
                <i id='p1S3x'><tr id='p1S3x'><dt id='p1S3x'><q id='p1S3x'><span id='p1S3x'><b id='p1S3x'><form id='p1S3x'><ins id='p1S3x'></ins><ul id='p1S3x'></ul><sub id='p1S3x'></sub></form><legend id='p1S3x'></legend><bdo id='p1S3x'><pre id='p1S3x'><center id='p1S3x'></center></pre></bdo></b><th id='p1S3x'></th></span></q></dt></tr></i><div id='p1S3x'><tfoot id='p1S3x'></tfoot><dl id='p1S3x'><fieldset id='p1S3x'></fieldset></dl></div>
                本文介绍了如何每X分钟运行一次cronjob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 cronjob 中运行 PHP 脚本,我想每 5 分钟发送一次电子邮件

                I'm running a PHP script in a cronjob and I want to send emails every 5 minutes

                我当前的(crontab)cronjob:

                My current (crontab) cronjob:

                10 * * * * /usr/bin/php /mydomain.in/cromail.php > /dev/null 2>&1
                

                cronmail.php 如下:

                The cronmail.php is as follows:

                <?php
                $from = 'D'; // sender
                $subject = 'S';
                $message = 'M';
                $message = wordwrap($message, 70);
                mail("myemail@gmail.com", $subject, $message, "From: $from
                ");
                ?>
                

                但是我在 30 分钟内没有收到有关此配置的电子邮件.

                But I've not received an email in 30 minutes with this configuration.

                推荐答案

                crontab 文件中,字段是:

                In a crontab file, the fields are:

                • 每小时的一分钟.
                • 一天中的几个小时.
                • 一个月中的第几天.
                • 一年中的一个月.
                • 星期几.

                所以:

                10 * * * * blah
                

                表示每小时过去 10 分钟执行 blah.

                means execute blah at 10 minutes past every hour.

                如果您想每五分钟使用一次:

                If you want every five minutes, use either:

                */5 * * * * blah
                

                表示每分钟但仅每五分之一,或:

                meaning every minute but only every fifth one, or:

                0,5,10,15,20,25,30,35,40,45,50,55 * * * * blah
                

                对于不理解 */x 符号的旧 cron 可执行文件.

                for older cron executables that don't understand the */x notation.

                如果之后它仍然似乎不起作用,请将命令更改为:

                If it still seems to be not working after that, change the command to something like:

                date >>/tmp/debug_cron_pax.txt
                

                并监视该文件以确保每五分钟写入一次内容.如果是这样,则说明您的 PHP 脚本有问题.如果没有,则您的 cron 守护进程有问题.

                and monitor that file to ensure something's being written every five minutes. If so, there's something wrong with your PHP scripts. If not, there's something wrong with your cron daemon.

                这篇关于如何每X分钟运行一次cronjob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tbody id='6fujo'></tbody>

                  • <bdo id='6fujo'></bdo><ul id='6fujo'></ul>
                      • <i id='6fujo'><tr id='6fujo'><dt id='6fujo'><q id='6fujo'><span id='6fujo'><b id='6fujo'><form id='6fujo'><ins id='6fujo'></ins><ul id='6fujo'></ul><sub id='6fujo'></sub></form><legend id='6fujo'></legend><bdo id='6fujo'><pre id='6fujo'><center id='6fujo'></center></pre></bdo></b><th id='6fujo'></th></span></q></dt></tr></i><div id='6fujo'><tfoot id='6fujo'></tfoot><dl id='6fujo'><fieldset id='6fujo'></fieldset></dl></div>
                      • <legend id='6fujo'><style id='6fujo'><dir id='6fujo'><q id='6fujo'></q></dir></style></legend><tfoot id='6fujo'></tfoot>

                        1. <small id='6fujo'></small><noframes id='6fujo'>