spustenie a planaovanie php skriptu

Programovacie jazyky, rady, poradňa...
harrison314
Hardcore addict
Hardcore addict
Používateľov profilový obrázok
Príspevky: 8224
Registrovaný: 27 máj 2009, 20:42
Bydlisko: Bratislava
Kontaktovať používateľa:

spustenie a planaovanie php skriptu

Príspevok od používateľa harrison314 »

ahoj, potreboval by som vediet ako cez CMD ( prikazovy riadok ) spustit PHP skript
skusla som nieco taketo ale to nefunguje ( toto som napisal do prikazoveho riadku )

Kód: Vybrať všetko

 C:\AppServ\php5\php.exe -C:AppServ\www\test.php
ani nasledujuca alternativa nejde

Kód: Vybrať všetko

C:\AppServ\php5\php.exe -test.php
poradte ako na to ?
A chcel by som aby sa spustil na pozadi ale ak to nepojde prezijem.
chrono
VIP
VIP
Používateľov profilový obrázok
Príspevky: 7127
Registrovaný: 25 dec 2006, 15:17

Príspevok od používateľa chrono »

Kód: Vybrať všetko

C:\AppServ\php5\php.exe test.php
nefunguje? (prípadne s celou cestou k tomu test.php súboru)
Ako dosiahnuť, aby to, vo Windows, bežalo na pozadí netuším.
Mmartin
Guru
Guru
Používateľov profilový obrázok
Príspevky: 2786
Registrovaný: 07 feb 2009, 12:49
Bydlisko: Bratislava

Príspevok od používateľa Mmartin »

chceš to pustit v browseri? ak hej, tak:

Kód: Vybrať všetko

start firefox http://localhost/test.php
harrison314
Hardcore addict
Hardcore addict
Používateľov profilový obrázok
Príspevky: 8224
Registrovaný: 27 máj 2009, 20:42
Bydlisko: Bratislava
Kontaktovať používateľa:

Príspevok od používateľa harrison314 »

praveze ja by som chcel aby to bezalo skryto, potrebujem to na skript ktory mi bude kontrolovat emailovu schranku kazddu pol hodinu
--==[ RA ]==--
Light Professional
Light Professional
Používateľov profilový obrázok
Príspevky: 841
Registrovaný: 03 mar 2006, 18:07
Bydlisko: Kosice
Kontaktovať používateľa:

Príspevok od používateľa --==[ RA ]==-- »

Nasiel som nieco take ale nemam to odskusane, vysusajte a dajte vediet ci to je dobry navod.
Configuring cron jobs on Windows

To setup a Windows machine to run cron.php at a specific time follow the specific instructions below. This can be useful if you are not familiar with Linux/Unix, or if your web host does not offer the ability to run cron jobs; you can run them remotely from your own computer.

Note: These instructions were written for Windows XP but should be similar in other versions of Windows.

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.
harrison314
Hardcore addict
Hardcore addict
Používateľov profilový obrázok
Príspevky: 8224
Registrovaný: 27 máj 2009, 20:42
Bydlisko: Bratislava
Kontaktovať používateľa:

Príspevok od používateľa harrison314 »

skusla som to ale nejde to , skusal som to aj pomocou davkoveho suboru ale tiez bez uspechu :

skuska.bat

Kód: Vybrať všetko

@ECHO off
start "C:/Program Files/Mozile Firefox/firefox.exe" http://localhost/test.php
ked ho spustim noralne tak ide ale ked ho naplanujem tak sa nic nestane ( test.php by mal vytvoryt subor na disku)

Kód: Vybrať všetko

AT 10:25 C:/skuska.bat


//autoeditácia príspevku ( 29 May 2009, 14:26 )
uz viem ako to spravit

treba si vytvorit davkovy subor :

Kód: Vybrať všetko

ECHO off
START "http://localhost/test.php" 
START Firefox "http://localhost/test.php" 
START "C:\Program Files\Mozilla Firefox\firefox.exe" "http://localhost/test.php"
ECHO on
EXIT
 
stci ked tam date jeden START , chcem len ukazat ze idu vsetky tri varianty

a potom cez prikazovy riadok naplanujete akciu

Kód: Vybrať všetko

AT 12:56 12.7.2009 /INTERACTIVE "C:/cesta/davkovy_subor.bat"
sice sa nespusti skryto ale ide to
Napísať odpoveď