PDA

View Full Version : اجرای اسکریپتی خاص در پریود زمانی معیین



houtanal
سه شنبه 20 اردیبهشت 1384, 23:16 عصر
سلام
در Cron jobs چگونه باید تعیین کنم که مثلا x.php هر ده دقیقه اجرا گردد؟

shaniaki
چهارشنبه 21 اردیبهشت 1384, 14:54 عصر
با عرض ادب:
یه همچین خطی به فایل /etc/crontab باید اضافه کنی:


00,10,20,30,40,50 * * * * root progname
در قسمت progname فایل php خود را (مثلا با آپاچی) صدا می زنید.

برای اطلاعات بیشتر:
http://www.htmlcenter.com/tutorials/tutorials.cfm?id=155&type=PHP

http://www.unixgeeks.org/security/newbie/unix/cron-1.html


http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/cron-task.html



یه ... خفن

houtanal
چهارشنبه 21 اردیبهشت 1384, 15:54 عصر
سلام
مشکل اینه که من جز cpanel به چیز دیگری در وب سرور دسترسی ندارم

oxygenws
چهارشنبه 21 اردیبهشت 1384, 19:57 عصر
CPanel بخشی برای cron داره (با نام cron job یا crontab)

houtanal
چهارشنبه 21 اردیبهشت 1384, 21:18 عصر
رفتم اونجا در اون بخش اگر فقط آدرس اسکریپت رو بنویسم حله؟یا باید چیز دیگه ای وارد کنم

shaniaki
چهارشنبه 21 اردیبهشت 1384, 23:27 عصر
با عرض ادب:

رفتم اونجا در اون بخش اگر فقط آدرس اسکریپت رو بنویسم حله؟یا باید چیز دیگه ای وارد کنم


The command line
This section can be any command that can be run from a command line. In this case we are setting it up to run a script.

* Path to PHP – In this section, you must specify the path to PHP or Perl, depending on what type of script you are trying to run. If you don’t know the path to PHP, then you can easily ask your server admin. Here are some examples of possible paths to PHP: /usr/bin/php, /usr/local/bin/php
* Flags for output – In this example I’ve used the –q flag which runs cron in quiet mode; this flag stops some unnecessary messages. You can also add /dev/null after the server path to stop error messages being output as well.
* Server Path to your script – You will need to specify the full server path directly to your script. If you know the path to your account, then you can simply add the remainder of the path to your actual script eg. /home/user1/public_html might be the path to your account (document root) and the script might be in sendstudio/users resulting in /home/user1/public_html/sendstudio/users/scriptname.php

http://www.interspire.com/whitepapers/html/Introduction_to_Cron.html
می تونی یه همچین چیزایی بنویسی:

php -q /home/username/public_html/cron.php
wget -q -O /dev/null /home/username/public_html/cron.php


یه ... خفن

houtanal
پنج شنبه 22 اردیبهشت 1384, 00:13 صبح
tnx