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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                How to parse django style template tags(如何解析 django 样式模板标签)
                What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                php in background exec() function(php 后台 exec() 函数)
                  <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'>