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

        • <bdo id='ZmOSr'></bdo><ul id='ZmOSr'></ul>
        <legend id='ZmOSr'><style id='ZmOSr'><dir id='ZmOSr'><q id='ZmOSr'></q></dir></style></legend>

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

        <i id='ZmOSr'><tr id='ZmOSr'><dt id='ZmOSr'><q id='ZmOSr'><span id='ZmOSr'><b id='ZmOSr'><form id='ZmOSr'><ins id='ZmOSr'></ins><ul id='ZmOSr'></ul><sub id='ZmOSr'></sub></form><legend id='ZmOSr'></legend><bdo id='ZmOSr'><pre id='ZmOSr'><center id='ZmOSr'></center></pre></bdo></b><th id='ZmOSr'></th></span></q></dt></tr></i><div id='ZmOSr'><tfoot id='ZmOSr'></tfoot><dl id='ZmOSr'><fieldset id='ZmOSr'></fieldset></dl></div>
      1. 使用 php 脚本安装 cron 作业

        Install a cron job with a php script(使用 php 脚本安装 cron 作业)
        <legend id='vFz88'><style id='vFz88'><dir id='vFz88'><q id='vFz88'></q></dir></style></legend>
            <tbody id='vFz88'></tbody>

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

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

              <tfoot id='vFz88'></tfoot>
                <bdo id='vFz88'></bdo><ul id='vFz88'></ul>
                • 本文介绍了使用 php 脚本安装 cron 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个需要使用 Cron 的 Web 应用程序.我想通过像 Wordpress 这样的自动安装过程来简化设置.在设置 Cron 之前,我一直在编写安装脚本没有问题.请告诉我是否可以这样做.

                  I'm developing a web application that requires the use of Cron. I'd like to make it easy to setup with an auto install process like Wordpress. I have no problems writing the install script up en till its time to set up Cron. Please tell me if I can do this.

                  推荐答案

                  您只需要创建 cron 文件,然后使用 exec 设置该 cron:

                  You just have to create the cron file, then use exec to set up that cron:

                  $cron_file = 'cron_filename';
                  // Create the file
                  touch($cron_file); 
                  // Make it writable
                  chmod($cron_file, 0777); 
                  // Save the cron
                  file_put_contents($cron_file, '* * * * * your_command'); 
                  // Install the cron
                  exec('crontab cron_file');
                  

                  这就要求运行 PHP 的用户有创建 crontab 的权限.默认情况下,此 cron 文件将替换该用户的任何其他 cron,因此请务必询问用户是否要应用该 cron.还要确保您正在写入 crontab 文件的文件夹是可写的.

                  This requires that the user which PHP is run under has the right to make crontabs. This cron file will by default replace any other crons for that user, so make sure to ask the user if he wants to apply the cron. Also make sure the folder you're writing the crontab file in is writable.

                  这篇关于使用 php 脚本安装 cron 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

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

                            <tbody id='NYFSD'></tbody>
                          • <small id='NYFSD'></small><noframes id='NYFSD'>