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

  • <legend id='ciSmP'><style id='ciSmP'><dir id='ciSmP'><q id='ciSmP'></q></dir></style></legend>

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

      1. <tfoot id='ciSmP'></tfoot>

      2. 如何在 Ubuntu 操作系统上每天使用 cron 作业运行 php 脚本

        how to run a php script daily with the cron job on Ubuntu os(如何在 Ubuntu 操作系统上每天使用 cron 作业运行 php 脚本)

        <small id='SQgDf'></small><noframes id='SQgDf'>

              <legend id='SQgDf'><style id='SQgDf'><dir id='SQgDf'><q id='SQgDf'></q></dir></style></legend>

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

                    <tbody id='SQgDf'></tbody>
                • 本文介绍了如何在 Ubuntu 操作系统上每天使用 cron 作业运行 php 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  要运行的命令我正在使用 ubuntu 12 和灯服务器.我想每 1 小时后运行一个 php 脚本.我已经创建了一个 crontab 来执行它,如果我使用命令 crontab -l 检查我的 cron 列表,它会显示如下

                  command to runI am using ubuntu 12 and lamp server . I want to run a php script after every 1 hour . i have create a crontab to execute this and if i check my cron list with command crontab -l it is showing like this

                  # Edit this file to introduce tasks to be run by cron.
                  0 * * * * /usr/bin/php5 -q /var/www/cronjobs/cron1.php
                  
                  # Each task to run has to be defined through a single line
                  # indicating with different fields when the task will be run
                  # and what command to run for the task
                  # 
                  # To define the time you can provide concrete values for
                  # minute (m), hour (h), day of month (dom), month (mon),
                  # and day of week (dow) or use '*' in these fields (for 'any').# 
                  # Notice that tasks will be started based on the cron's system
                  # daemon's notion of time and timezones.
                  # 
                  # Output of the crontab jobs (including errors) is sent through
                  # email to the user the crontab file belongs to (unless redirected).
                  # 
                  # For example, you can run a backup of all your user accounts
                  # at 5 a.m every week with:
                  # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
                  # 
                  # For more information see the manual pages of crontab(5) and cron(8)
                  # 
                  # m h  dom mon dow   command
                  

                  这是我的php脚本

                  0 * * * * /usr/bin/php5 -q /var/www/cronjobs/cron1.php
                  

                  但它没有执行

                  我如何检查它为什么不起作用,请帮忙

                  how can i check why it is not working , please help

                  推荐答案

                  要找出您的 cron 有什么问题,您可以在终端中输入以下命令:

                  To find out what is wrong with your cron you can type the following command in your terminal:

                  grep -i "cron1.php" /var/log/syslog
                  

                  系统日志包含所有 cron 日志.

                  The syslog contains all log of crons.

                  尝试在终端上运行代码 /usr/bin/php5 -q/var/www/cronjobs/cron1.php 以检查是否有错误.

                  Try run the code /usr/bin/php5 -q /var/www/cronjobs/cron1.php on terminal to check if there are errors.

                  您还可以将所有错误重定向到一个文件:

                  You can also redirect all errors to a file:

                  0 * * * * /usr/bin/php5 -q /var/www/cronjobs/cron1.php 2> /tmp/errorCron1.txt
                  

                  这篇关于如何在 Ubuntu 操作系统上每天使用 cron 作业运行 php 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

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

                          <small id='nXCgj'></small><noframes id='nXCgj'>

                          <legend id='nXCgj'><style id='nXCgj'><dir id='nXCgj'><q id='nXCgj'></q></dir></style></legend>

                          1. <tfoot id='nXCgj'></tfoot>