954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Question about Pycron for windows

Hi I test my web on my localhost(winxp+ie8+mysql5.0.51a+PHP 5.2.11+Apache 2.2.13). I want to add some cron job for my php files. I select Pycron. After configuration, I add some command in crontab.txt

* * * * * "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://localhost/test/index1.php.


It is success, it will open IEXPLORE.EXE and load index1.php for every minute. But it still open the IEXPLORE windows, not for close. how to set it automatic finish the php job, then close the IEXPLORE windows? thanks.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

I'm assuming you only want to run the php file, and not view the output. So, instead of running it with iexplore, run it with php.exe

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Hi, pritaeas. I'm newer to use cron job. would you like to tell me where is the php.exe? Thanks.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Somewhere in you local setup, it depends on whether you installed everything manually, or used a tool like WAMP or XAMPP. Just look for the PHP folder.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Hi, thanks. I find it.

* * * * * "C:\Program Files\PHP5\php.exe" http://localhost/test/index1.php.

But, it is only flashing a bit on the screen(like CMD windows continued about half a second), then nothing happened. the index1.php should insert something into my database for a cron test. but now, there has nothing insert into database. I test index1.php in IE, it can work well. What do you think the problem? my php.exe is bad? Or because I use a wrong cron command code?

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

try a filepath (c:\...\index1.php) instead of an url

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks, pritaeas. my www folder is in e:\ I have tried

* * * * * "C:\Program Files\PHP5\php.exe" e:\www\test\index1.php.


But it also flashing a bit on the screen(like CMD windows continued about half a second), then nothing happened more...
still need your warmly help.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Remove the dot at the end.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks for a quickly replay. this time the php file can work well.
By the way, I also want cron do other orders. can cron run a bat files?

* * * * * "C:\WINDOWS\system32\cmd.exe" e:\www\test\test.bat

It looks fail. 'executing return code =-1073741510'
And how many files can a cron run at the same time? for example in 19:45, I want run 15 php files, will it cause a heavy pressure for the web server?

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Won't the bat file execute just fine without the cmd ?

Depends on what those 15 files do.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

but how to write? there have two blanks need to write: command and paramente.
I write C:\WINDOWS\system32\cmd.exe in 'command', and write 'e:\www\test\test.bat' in paramente.
15 files all do something with database. read the database and create html pages.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Move bat to command, and no parameters.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks, you teach me more. now I solve my problems.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

No problem. Please mark this thread solved.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Hi, how to mark a thread to be solved?

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

There should be a button/link somewhere in this thread labeled "mark as solved".

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

I'm sorry I still not find. here is a screenshot of this thread.
screenshot

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

The link is at the bottom, in the text just above the reply area.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks, I see it. and clicked it. Good night pritaeas.

youlichika
Light Poster
31 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: