Ubuntu 16.10 x64 上的 Laravel 5.3 的 Cron 作业

2024-03-18

我正在运行 Digital Ocean 的 Ubuntu 16.10 x64,并在服务器上部署了 php Framework Laravel 5.3.28。 在大多数情况下,一切都正常工作,但是我试图让 crontab 调用 artisan 命令,例如php artisan schedule:run这样laravel的任务调度器就可以使用了。

我不想下载任何额外的软件包来完成这项工作,因为我觉得实际上没有必要,因为 cron 可以调用(看起来像)任何编码正确的命令。

我正在尝试做的事情:

从内部crontab -e我正在尝试正确编写 Ubuntu 的正确调用方式php artisan schedule:run

我做了什么:

我目前已经尝试了多种不同的方式来编写此命令,但没有任何效果,如下所示:

#Attempt for cron
SHELL=/bin/bash
#PATH=????? <---Confused if this is even needed
* * * * * php /path/to/artisan scheduled:run 1>> file.log 2>&1
* * * * * /path/to/php artisan scheduled:run 1>> file.log 2>&1
* * * * * /path/to/php artisan scheduled:run >> file.log
* * * * * /path/to/php artisan scheduled:run 1>> file.log
* * * * * /path/to/php artisan schedule:run
* * * * * /path/to/php /path/to/artisan scheduled:run 1>> file.log

我已经使用多种资源来尝试找到答案,但似乎没有任何东西可以解决我的具体问题。

资源:

  • https://laracasts.com/series/intermediate-laravel/episodes/2?autoplay=true https://laracasts.com/series/intermediate-laravel/episodes/2?autoplay=true

  • http://laravel.io/forum/03-05-2014-automated-mysql-backups?page=1 http://laravel.io/forum/03-05-2014-automated-mysql-backups?page=1

  • https://laracasts.com/discuss/channels/laravel/setting-up-larvel-cron https://laracasts.com/discuss/channels/laravel/setting-up-larvel-cron

  • https://community.centminmod.com/threads/how-to-run-a-cron-job-properly.2287/ https://community.centminmod.com/threads/how-to-run-a-cron-job-properly.2287/

  • https://laravel.com/docs/5.3/scheduling https://laravel.com/docs/5.3/scheduling

  • https://laracasts.com/lessons/recurring-tasks-the-laravel-way https://laracasts.com/lessons/recurring-tasks-the-laravel-way

  • https://laracasts.com/index.php/discuss/channels/laravel/laravel-artisan-commands-trough-cron-tab https://laracasts.com/index.php/discuss/channels/laravel/laravel-artisan-commands-trough-cron-tab

  • https://deploybot.com/guides/deploy-a-laravel-app-to-digitalocean https://deploybot.com/guides/deploy-a-laravel-app-to-digitalocean

结论:

在这一点上,我陷入了困境。有人可以帮帮我吗?我想做的就是使用 Ubuntu 的 cron 调用 php artisan 命令,但我不知道具体的方法。非常感谢任何和所有的帮助。

提前致谢,

节日快乐!!


开始了。这就是我的样子。 :)

* * * * * php /home/spacemudd/laravel/artisan schedule:run >> /dev/null 2>&1

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ubuntu 16.10 x64 上的 Laravel 5.3 的 Cron 作业 的相关文章

  • Monolog Logger 在每个日志消息的末尾输出空数组

    我的记录器对象在每行末尾输出空数组 例如 2017 08 17 12 26 02 import log INFO checkForDuplicates is processing 2017 08 17 12 26 04 import log
  • 限制用户角色仅更改 Woocommerce 中的某些订单状态 [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我想限制按角色访问 woocommerce 下拉列表中的某些订单状态 我已经在functions php子主题中尝试过代码按角色限制
  • Yii2:ActiveController 中的 REST API 操作

    在文档指南中有示例 namespace app controllers use yii rest ActiveController class UserController extends ActiveController public m
  • 无法在 R 中安装插入符号包(在我的 Linux 机器中)

    我在尝试在 R 中安装插入符号包时遇到以下错误 g error tmp Rtmp2Tos7n R INSTALL2e6e30153a74 nloptr nlopt 2 4 2 lib libnlopt cxx a No such file
  • 无法打开“storage/logs/laravel-2019-11-22.log”:无法打开流:权限被拒绝

    在生产服务器上输入我的网站时出现以下错误 无法打开流或文件 var app current storage logs laravel 2019 11 22 log 无法打开流 权限被拒绝 我尝试运行以下命令 但 git 权限在终端中被拒绝
  • bash 别名中允许使用哪些字符[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我最近添加了 alias cd alias cd alias cd 到我的 bash aliases 文件 玩弄这个 我注意到在别名时 被
  • PHP:向网址添加参数?

    如果我有网址mysite com test php id 1 The id在页面加载时设置 可以是任何内容 那里还可能有其他人 例如 id 1 sort new 有没有办法只在末尾添加另一个而不先找出其他人是什么 然后构建新的网址 谢谢 作
  • 如何在 PHP 中验证小数

    如何在 PHP 中验证十进制数字 我查看了 is numeric 但这对我不起作用 bool is numeric 混合变量 查找给定变量是否为 数字 数字字符串包括 可选符号 任意数量的数字 可选的小数部分和可选的 指数部分 因此 012
  • Linux 的 gcc __attribute__((selectany)) 替代方案?

    我想知道是否有替代方案 attribute selectany 在Linux中 我想定义这样的东西 char a qwe zxc 并将其包含在许多链接在一起的 c 文件中 因此链接器将看到 a 的多个定义 因此不会链接 我读过这个属性 se
  • 更改 WooCommerce 购物车和结帐页面中的“运输”文本:[重复]

    这个问题在这里已经有答案了 我正在将 WooCommerce 与 Storefront 主题一起使用 并且我正在尝试更改这个词 船运 在带有总计的购物篮页面上 我在这里找到了一些建议 https kriesi at support topi
  • 如何用PHP制作下载链接? [关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我可以使用 sql 在数据库中上传文
  • 从汇编程序获取命令行参数

    通读 专业汇编语言书籍 似乎它提供了用于读取命令行参数的错误代码 我纠正了一点 现在它从段错误变成了读取参数计数 然后是段错误 这是完整的代码 data output1 asciz There are d params n output2
  • 使用正则表达式在图像标签周围添加链接

    我想使用 preg replace 在图像标签周围添加链接 Before img href src alt After a href img href src alt a 我将非常感谢任何帮助 非常感谢 这有帮助吗 str img href
  • C中的内存使用问题

    请帮忙 操作系统 Linux 其中 sleep 1000 中 此时 top 显示Linux任务 给我写了7 7 MEM使用 valgrind 未发现内存泄漏 我明白 写得正确 所有 malloc 结果都是 NULL 但是为什么这次 睡眠 我
  • PHP 中字符串中的类常量

    我的阅读手册 http www php net manual en language types string php language types string parsing 标题 字符串访问和按字符修改 之前的部分 是 您可以在字符串
  • Facebook 爬虫严重攻击我的服务器并忽略指令。多次访问相同资源

    Facebook 爬虫每秒多次访问我的服务器 它似乎忽略了 Expires 标头和 og ttl 属性 在某些情况下 它会在 1 5 分钟内多次访问同一 og image 资源 在一个示例中 爬虫程序在 3 分钟内使用 12 个不同的 IP
  • 来自链接参数的多个 $_GET

    我使用 js 将值发送到 php 文件 如下所示 validation php firstName test lastName test email test contactNumber test title test descriptio
  • 使用 PHP 的 HTML 中的选项字段

    我想根据从下拉列表中选择的区域名称搜索员工列表 我可以将数据库中的区域名称检索到 PHP HTML 的下拉列表中 但现在我很困惑如何将下拉列表中的选定选项传递给 PHP 中的 SQL 查询 我还想要索引号 选定的选项 我的代码如下
  • 另一个数组内的 stdClass 对象数组

    我正在尝试从下面的 array1 获取信息 通过执行以下操作 我可以毫无问题地获取场地名称和地点地址 array2 array array3 array foreach array1 as item array2 item gt venue
  • MySQL GROUP 通过还是使用 PHP?

    我有一个看起来很简单的问题 但我只是想问你如何解决它 在 MySQL 表中有以下结构 provider artist a 1 a 2 a 3 b 4 现在需要在 HTML 中回显一个列表 例如 provider a 1 2 3 provid

随机推荐