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

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

                  相关文档推荐

                  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() 函数)

                    <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'>