cron job problem?

nexty

Junior Member
Joined
Oct 18, 2009
Messages
109
Reaction score
38
Hi there,

I have done a script that allow to grab something from a website and put in on a text file, after that I launch a cleaner (remove duplicate content)

my script work as I want manually

but since I dont get a lot of experience in cronjob, I'm using the cPanel cronjob

so the point:

I need first to launch the get.php - this php code, will check the url in list.txt and after that write the result in list2.txt

second cron job after a several minute, will need to run clean.php who need to have acces to list2.txt and remove the duplicate content from list2.txt and writte on this file

I get sometrouble to runing this, nobody have an idea of what argument I need to put on my cronjob activity?

thanks
 
there are several methods to go:
1. use "wget" or "curl" in a cronjob (as already stated above)
2. there are websites out there which provide cronjob services (open a url in regular periods)
3. you can create a linux typical cronjob in /etc/cron.d/<something_here> which will open the php command line binary which will then parse your code. that whould produce no traffic at all ;)

cpanel cronjobs can be installed as already posted above. i hope this helps :)
 
Make a shell script..

Code:
#!/bin/sh
for i in `cat /some/path/on/your/server/list.txt`
do
curl -o /dev/null -A "Mozilla/4.0 (compatible; Your Desired Agent)" -s "http://localhost.localdomain/scripts/get.php?p=$i" >> /tmp/list2.txt &
sleep 3
echo $i done
done
cat /tmp/list2.txt | sort -u >> /some/path/on/your/server/list2.txt

To schedule the job for every Tuesday at 04:35 am:
Code:
35 4 * * 2 /some/path/on/your/server/getem.sh > /dev/null 2>&1

I've done this once or twice ;)
 
Back
Top