简体   繁体   English

如何使用cron作业使外部nopcommerce网站在IIS中保持活动

[英]how to keep external nopcommerce website alive in IIS using cron job

I have a NopCommerce website on a limited "shared" hosting (no access to the IIS/server settings) and it has a /keepalive/Ping.ashx that executes every 60 seconds to return "Ping" string 我在受限的“共享”主机上拥有一个NopCommerce网站(无法访问IIS /服务器设置),并且它有一个/keepalive/Ping.ashx,每60秒执行一次以返回“ Ping”字符串

I need this to keep IIS from removing the site from its memory/cache/cycle/pool if there is no traffic. 我需要这样做,以防止IIS在没有流量的情况下从其内存/缓存/循环/池中删除该站点。 How can i know whether that script is running? 我怎么知道该脚本是否正在运行?

Do i have to do the same using a php cron. 我是否必须使用php cron做同样的事情。 is it possible? 可能吗? and how? 如何?

Please let me know Thanks 请让我知道,谢谢

Assuming that the ping string means that the server is OK you just need to create a script that runs under cron, Windows Task Scheduler etc to request the ping.ashx url. 假设ping字符串表示服务器正常,您只需要创建一个在cron,Windows Task Scheduler等环境下运行的脚本即可请求ping.ashx url。 You could write this in a programming language like PHP but it might be easier to do it with some command line tools. 您可以使用PHP之类的编程语言来编写此代码,但是使用某些命令行工具可能更容易做到这一点。 Either way it is a simple bit of code. 无论哪种方式,它都是简单的代码。

Off the top of my head you can do something like this on Linux to pull down and match the string. 在我的头上,您可以在Linux上执行类似的操作以下拉并匹配字符串。 You'll need to modify if you need to match on something other than Ping in case it returns an error message: 如果您需要匹配除Ping以外的其他内容,则需要进行修改,以防其返回错误消息:

curl http://site/keepalive/ping.ashx | grep "Ping"

If you provide information on what types of scripts you can run on your hosting I can provide more help. 如果您提供有关可以在主机上运行的脚本类型的信息,我可以提供更多帮助。 If you have a control panel for the shared hosting you might find a builtin task scheduler you can use. 如果您有一个用于共享主机的控制面板,则可能会找到一个内置的任务计划程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM