Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies


need to automate a few simple functions

10:31 pm on Oct 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 19, 2004
votes: 0

Hey there,
I have a serious of tasks that my script does

and I need to run them every hour at night while sleeping. How can I create a simple script that would allow me to do this?

Thanks in advance :)

10:38 pm on Oct 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:July 18, 2005
votes: 0

Sure can! :) If you're on windows, do this: Make a bat file where you put:

cd <dir where scripts are>
php task1.php
php task2.php
php task3.php

and save the file as tasks.bat. Now you add a scheduled task by going to Start->All programs->Accessories->System tools->Scheduled tasks

Click add scheduled task and follow the rather simple step-by-step wizard. When it asks for which program to execute, locate your bat file. The bat-file above assumes you have the php executable in your system path. If not, either add it (Right click My computer, Advanced, Environment variables - path) or do

C:\php\bin\php.exe task1.php

in your bat file. If you're on Linux, you'll need to check up crontabs, which someone else can explain better than me...

11:26 pm on Oct 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 19, 2004
votes: 0

sweet! thanks for the quick response. I didnt think of running it through windows...

However, the script is external on a server...can the batch file still work if it points to [domain.com...]

Thanks again!

3:17 pm on Oct 6, 2005 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
votes: 0

maybe remote would work, it all depends on what those scripts are doing.
5:44 pm on Oct 9, 2005 (gmt 0)

New User

10+ Year Member

joined:Mar 21, 2004
votes: 0

you can use wget to run the php through the webserver or set the scripts with the php path at the top if you have php as a cgi on the server.

log in via ssh and type crontab -l to list your crons, 'man crontab' for detailed instructions.

my crontab looks like

0 6 * * * wget -q http://www.example.com/follow_up.php
0 3 * * * wget -q http://www.example.com/reminder.php

[edited by: coopster at 6:28 pm (utc) on Oct. 10, 2005]
[edit reason] removed ulr per TOS [webmasterworld.com] [/edit]


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members