PDA

View Full Version : سوال: روشی برای اجرای کد در زمان مشخص



mahdik
دوشنبه 22 شهریور 1389, 03:36 صبح
سلام دوستان عزیز

من کدی دارم که میخوام در زمان های مشخصی اجرا بشه و اطلاعاتی رو برام بگیره .
باید چیکار کرد ؟

نمیخوام از روش رفرش صفحه استفاده کنم چون باید همیشه صفحه باز باشه و مشکلات خودش رو داره

ممنون اگه کمک کنید

با تشکر

yasgig
دوشنبه 22 شهریور 1389, 08:52 صبح
توی سی پنل به بخش cron jobs برید و از اونجا تنظیم کنید.

mahdik
دوشنبه 22 شهریور 1389, 10:11 صبح
سلام

دوست عزیز ممنون ولی این سیستم قرار روی لوکال کار کنه با برنامه wamp و رو سیستم ویندوز

آیا راهی دارید ؟

ممنون

binyaft
دوشنبه 22 شهریور 1389, 10:29 صبح
فک نکنم این فقط روی سرور های لینوکس هست

xoogle.ir
دوشنبه 22 شهریور 1389, 10:44 صبح
شدنش میشه ولی راهش رو نمیدونم.
باید یه برنامه ای بنویسید که فایل php.exe رو باز کنه و اون فایلی که دستورات php تون توش هست رو اجرا کنه.

yasgig
دوشنبه 22 شهریور 1389, 10:47 صبح
فک نکنم این فقط روی سرور های لینوکس هست

چرا امکانش هست.اینم توضیحاتش:

Creating a Scheduled Task

1. Open Scheduler
2. Go to Start > Programs > Accessories > System Tools > Scheduled Tasks
3. Double-click Add Scheduled Task
4. The Scheduled Task Wizard will appear. Click Next.
5. Select the program to run. Choose your browser from the list (for example, Internet Explorer or Mozilla Firefox). Click Next.
6. Give the task a Name, such as Drupal Cron Job, and choose the Frequency with which to perform the task (for example, Daily)). Click Next.
7. Choose specific date and time options (this step will vary, depending on the option selected in the previous step). When finished, click Next.
8. Enter your password if prompted. Change the username if required (for example, you'd like the task to run under a user with fewer privileges security reasons). Click Next.
9. On the final page, select the checkbox Open advanced properties for this task when I click Finish and click Finish.

Configuring the task

1. Go to the task's setting page either by checking the checkbox at the end of the last step, or by double-clicking on the task.
2. In the Run box, after the text that is there now (for example, C:\PROGRA~1\MOZILL~1\firefox.exe), enter a space and then type the address to your website's cron.php page in double quotations (for example, C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/cron.php
3. To set a frequency more often than Daily (for example, hourly), click the Schedule tab, then click Advanced. Here you can set options such as Repeat task, every 1 hour for 23 hours. Click Ok when finished.
4. Change the start time on the task to one minute from the current time. This will allow you to test the task and make sure that it is working.
5. When all settings have been configured to your liking, click Apply and OK (note: you may be prompted for your password)

Command-line version

Another way to perform the above commands is by using the schtasks (or at in Windows 2000) command from the command line. To duplicate the example above, which runs Firefox hourly to execute http://www.example.com/cron.php, open a command prompt (Start > Programs > Accessories > Command Prompt) and enter:

schtasks /create /tn "Drupal Cron Job" /tr "C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/cron.php" /sc hourly

Enter your password if prompted

mahdik
دوشنبه 22 شهریور 1389, 17:27 عصر
سلام و ممنو

آجه مشکلی که اینجا هست اینه که باز باید یه برنامه مرورگر باز بشه تا اون اسکریپت اجرا بشه

من نمیخوام چنین بشه یعنی برنامه ای باز بشه

دلیلش هم اینه که میتونه برنامه مشکل پیدا کنه یا کرش کنه و ....

آیا راه دیگه ای هست

ممنون