cron作业在webserver上 [英] cron job on webserver

查看:177
本文介绍了cron作业在webserver上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我研究过cron工作的最后几天。首先我想告诉你abaout我的问题。
我想在我的web服务器上运行一个php脚本每分钟,而不加载页面。这个php脚本通过yql插入一些数据。我读了cron只是工作与unix / linux。我的服务器运行在unix上(等待它)。是现在可以让我让我的脚本运行时睡在床上(电脑关闭)只是由服务器端?我有这个好吗?如果是的话,我还必须知道在我的调度中我的命令部分中的路径是什么样子,因为每个示例内容都像* * / 1 * * * / usr / bin / wget http://www.example.com/cron.php ,但为什么在/ usr / bin / wget中路径(这意味着,这个cron只是从我的计算机系统而不是从Web服务器运行),以及如何将我的日程安排在服务器上更好的位置。我的服务器有根public_html其中我的index.php在里面。请给我一个例子,如何激活我的php数据称为to_fire.php,通过mysql将数据放到我的数据库。



我希望一些的你知道我自己的经验是什么意思。



感谢

解决方案


  1. wget 是一个访问网址的unix命令。 curl 是另一个类似工作的命令。你也可以使用 php path \to\script.php 运行,正如Gigawatt提到的。

    cron时间。


  2. / usr / bin / wget wget


  3. 是的,一旦cron设置,您可以单独保留。只要服务器是活的,cron将按计划运行。


  4. 运行cron每分钟似乎不是每分钟运行一次共同。


  5. Cron可以在cPanel上设置。


  6. 您需要将cron脚本配置为只接受来自同一服务器的请求,以避免其他人访问此网址。




cron的一些资源



在cPanel中配置cron作业 http://drupal.org/node/369267



使用cron备份数据库 http://wiki.lunarpages.com/Backup_Databases_using_a_cron



使用cron命令配置cron作业 http://drupal.org/node/23714



使用PHP管理Cron作业 http://net.tutsplus .com / tutorials / php / managing-cron-jobs-with-php-2 /


the last days I have researched about cron jobs. First I want to tell you abaout my problem. I want to run a php script on my webserver every minute without loading the page. this php script inserts some data via yql. I read that cron is just working with unix/linux. my server runs on unix (wait for it). is it now possible for me to let my script run while sleeping in bed (computer off) just by the server side? do I got this all right? if yes, I also have to know how the path have to be look like in my command part in my schedule, because every example contents something like "* */1 * * * /usr/bin/wget http://www.example.com/cron.php", but why there is /usr/bin/wget in the path (that means, this cron is running just from my computer system not from the webserver) and how to put my schedule on the server and better where. my server have the root public_html where my index.php is inside. please give me an example of the schedule and how to fire my php data called "to_fire.php" that puts the data on my database via mysql.

I hope that some of you know what I exactly mean by own experience. im kinda confused by this command part and how to let it run from just the webserver and not my computer system.

thanks

解决方案

  1. wget is a unix command to visit a web URL. curl is another command working similarly. You could also use php path\to\script.php to run, as Gigawatt mentioned. There is no big difference from all of them

  2. * */1 * * * is to set cron timing.

  3. /usr/bin/wget is the location where wget on your server

  4. Yes, once cron set, you can leave it alone. As long as server is living, the cron will run as scheduled. You can even set cron to send you an email, but that's no applicable to your case as running per min is to short.

  5. Running cron per min seems not common. If you are doing something like realtime update, consider other solution.

  6. Cron can be set on cPanel.

  7. You need to config your cron script to accept request from same server only, to avoid others access this URL.

Some resource for cron

Configuring cron jobs in cPanel http://drupal.org/node/369267

Backup Databases using a cron http://wiki.lunarpages.com/Backup_Databases_using_a_cron

Configuring cron jobs using the cron command http://drupal.org/node/23714

Managing Cron Jobs with PHP http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

这篇关于cron作业在webserver上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆