I've seen a few other people looking for the same solution, to I thought I'd wake it back up. If anyone else needs the same, could you add a reply to this post.
Using a CRON task to automatically run EasyPopulate imports
Our stock files are uploaded, pre-split, by a stock control system we have developed. It'd be great if the site were to run the import silently, so you dont need to log in to admin and run the import x number of times.
My attempts so far
I have tried to get this working using a cron task to automatically run EasyPopulate every 10 mins, but only if a certain file has been uploaded. This means that we upload files stock1, stock2, stock3 and a file called Doimport. The cron task runs a script, the script will then execute a SHELL SCRIPT (subtly different to perl)
0,10,20,30,40,50 * * * * /usr/local/psa/home/vhosts/website.co.uk/cgi-bin/update 2>&1 >/dev/null
update script file:
#!/bin/sh
[ -e /usr/local/psa/home/vhosts/website.co.uk/httpdocs/catalog/temp/Doimport ] || exit
rm /usr/local/psa/home/vhosts/website.co.uk/httpdocs/catalog/temp/Doimport
echo "<CONTENT-TYPE: text/html>"
echo ""
echo "<HTML><BODY><H1>DONE</H1>"
for I in `ls /usr/local/psa/home/vhosts/website.co.uk/httpdocs/catalog/temp/osc*`
do
T=${I##*/}
echo "$I $T"
echo "<BR>"
wget --output-document=- --timeout=300 --http-user=username --http-passwd=password http://www.website.co.uk/catalog/admin/easypopulate.php?localfile=$T&buttoninsert=INSERT_INTO_DB 2>&1 > /dev/null
done
echo "</BODY></HTML>"
To paraphrase, for each file matching the name osc*, run the easypopulate script for the file. This operates only if the Doimport file exists. Doimport is then deleted, so the script doesn't run in another 10 mins.
Importantly, wget allows us to 'log in' to admin
Problem is,
A ) the script will run the import for stock1, stock2 etc all at the same time, so the server gets tied up trying to do all the imports symultaneously, the site slows to a crawl and none of the imports happen. The error log eventually says 'giving up' for each file.
B ) The user gets no feedback if imports fail. An email would be nice!
Anyone else looking for similar functionality? If you could try the above and let me know if you have any successes, also record how many product lines were imported, how many split files you had etc.
Also, anyone else after the same solution please register your interest!
Thanks
Matt Brown
btw, I have posted the request on the EP V3 requests list at http://www.oscommerce.com/forums/index.php?showtopic=153115.