0

我有一台运行 centOS 的主机。我的网站基于 Magento 并且是实时的。

我创建了一个每分钟运行一个 cron 作业的模块。

我的问题是:我在 Windows(wampserver 2.0)上运行我的本地主机。在将我的模块上传到实时主机之前,我想在本地主机上对其进行测试。是否可以在 Windows 上测试我的 cron 作业运行模块?

4

6 回答 6

6

通过说您的模块“运行”一个 cron 作业,您可能的意思是添加了一个 cron 作业。为了测试它,您不需要 cron 在您的 Windows localhost 上运行。cron.php您可以通过从 Magento 安装的根目录运行手动触发所有 Magneto cron 作业。您可以从这样的浏览器中执行此操作http://localhost/magento_dir/cron.php

于 2013-01-06T16:31:58.187 回答
1

您至少有 2 个选项:

  1. 您可以使用 Windows 调度程序调用脚本。
  2. 您可以像在 Linux 中一样安装 Cygwin 并定义 cron 任务。更多信息在这里:如何在 Windows 上的 Cygwin 中运行 crontab?
于 2013-01-06T12:35:59.637 回答
1

Magento 2.0.2 打开命令提示符

cd c:\xampp\htdocs\magento202\bin
php magento cron:run
php magento cron:run
cd C:\xampp\htdocs\magento202\update
php cron.php
cd c:\xampp\htdocs\magento202\bin
php magento setup:cron:run

用你的替换目录'magento202'

于 2016-03-26T23:04:00.373 回答
0

您可以使用 schtasks.exe 创建新的计划任务以根据需要运行。

schtasks /create /sc minute /mo 1 /tn "Cron" /tr "php -f C:\wamp\www\pro\run.php"

您可以在我的博客的以下链接中找到有关命令和用法的更多信息。

http://purusothaman.me/computers/running-cron-in-windows/

于 2013-11-20T18:30:28.283 回答
0

如果使用 Windows 2008 及更高版本,请进入管理 MMC 并访问配置下的任务计划程序。对于 1.8,Mage 必须在您的声明中添加 -mdefault 1。cron 文件中有更改。

于 2014-03-12T02:31:18.990 回答
0

“你可以从像这样的浏览器http://localhost/magento_dir/cron.php ” > 你会拒绝访问 -> 去编辑 .htaccess 和注释行

###########################################
## Deny access to cron.php
##   <Files cron.php>

############################################
## uncomment next lines to enable cron access with base HTTP authorization
## http://httpd.apache.org/docs/2.2/howto/auth.html
##
## Warning: .htpasswd file should be placed somewhere not accessible from the web.
## This is so that folks cannot download the password file.
## For example, if your documents are served out of /usr/local/apache/htdocs
## you might want to put the password file(s) in /usr/local/apache/.
#AuthName "Cron auth"
#AuthUserFile ../.htpasswd
#AuthType basic
#Require valid-user
############################################
##     Order allow,deny
##   Deny from all
##</Files>
于 2017-02-15T17:06:03.953 回答