I have followed your instructions but I’m unclear upon creating the two files you mention in your documentation (importer_cron.sh and importer_cron_batch.sh) exactly where I should put them? I’ve created the cron jobs on my server, and I’ve attached the screenshot of what it looks like. All i did was create the two cron jobs needed and pasted the code from your example See Attached
When the cron job runs, I get notified of this:
sh: /Library/WebServer/Documents/ExpressionEngine2/importer_cron_batch.sh: No such file or directory
should that line look more like this:
sh /home/mysite/public_html/cron/importer_cron_batch.sh
In addition to this issue, I’m getting error after error within this module. Almost every button errors out but then if I stay in the module long enough the errors disappear. Here’s one that appears often:
A Database Error Occurred
Error Number: 1054
Unknown column 'batch_date' in 'where clause'
DELETE FROM exp_importer_batch_data WHERE batch_date < 1329610256
Filename: third_party/importer/mcp.importer.php
Line Number: 92
Hi jeramiah, about the error, I’ll assume you’re on EE 2.4 and Importer 2.0.2 and that this issue is related to this thread. I’m not sure if this is a separate issue from your cron question. ![]()
As for cron, you can place your scripts anywhere on your server, as long as they are accessible and can be run. Where did you place your importer_cron.sh and importer_cron_batch.sh scripts? Do you have a /Library/WebServer/Documents/ExpressionEngine2/ folder? (*that path is only an example, btw. You don’t have to set that path if you placed your scripts elsewhere)
I think it would be more helpful if I put what I’m actually doing so I apologize for not doing that.
Attached you’ll see my cron job setup (not sure if properly) to hit scripts located in those exact directories.
This is the exact code in my scripts:
importer_cron.sh
/usr/local/bin/wget http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
importer_cron_batch.sh
/usr/local/bin/wget http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo&batch=yes
With these settings I’m getting this error:
/home/makingca/public_html/cron/importer_cron_batch.sh: line 1: /usr/local/bin/wget: No such file or directory
Alright, I see that that you changed the paths, that’s good
I assume the path to the script files are correct now?
Next, I would check that you have the right header in the bash scripts. Do your bash script files have this on the first line?:
#!/bin/bash
Also, have you checked that /usr/local/bin/wget exists?
I have corrected my files:
#!/usr/bin/env bash
/usr/local/bin/wget http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
#!/usr/bin/env bash
/usr/local/bin/wget http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo&batch=yes
/usr/local/bin/wget does not exist. I don’t have “user/” located before root. Would it be known as something else? Thank you for your rast replies!!
I don’t have “user/” located before root
I’m not sure I quite understand this.
In any case, where is wget placed on your server? If it’s not in /usr/local/bin, then you would need to change that path to where wget is installed (if it’s even installed
).
yup, iI’m sorry I called my hosting provider and they said my path is: /usr/bin/wget
so my code now looks like this:
#!/usr/bin/env bash
/usr/bin/wget http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
#!/usr/bin/env bash
/usr/bin/wget
http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo&batch=yes
I’m going to see if this runs properly in a few minutes.
The scripts look fine from what I see then. ![]()
Have you tried running these scripts from the terminal to see if they run on their own?
Also, are you sure
#!/usr/bin/env bash
...is the right first line to have to run your script?
actually it looks like it’s hitting the script because now I’m getting a new error:
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget—help’ for more options.
/home/makingca/public_html/cron/importer_cron_batch.sh: line 4: http://mysite.com/index.php?ACT=32: No such file or directory
Have you tried loading
http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
...directly in a browser window to see if you get a response from EE at least (i.e. no 404 or similar error)?
How about if your script has only:
#!/usr/bin/env bash
/usr/bin/wget http://mysite.com/index.php
or
#!/usr/bin/env bash
/usr/bin/wget http://google.com
Do you still get an error then?
How about when using wget directly from a terminal window?
A second phone call to my hosting provider showed that wget wasn’t enabled on my server (hostgator). Also, we’ve corrected my code.
importer_cron.sh
#!/bin/bash
/usr/bin/wget http://makingcarbuyingeasy.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
It should be enabled int he next ten minutes so we’ll see what happens when the script is fired then. Thanks!
Sounds good, let us know how that goes
Nicolas—
Does this look correct? This is the email I get after the cron runs. No errors! However, nothing is saving to the channel.
—2012-02-27 15:15:02— http://mysite.com/index.php?ACT=32
Resolving mysite.com… 174.121.85.131 Connecting to mysite.com|174.121.85.131|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 0 [text/html]
Saving to: `index.php?ACT=32.1’
0K 0.00 =0s
2012-02-27 15:15:02 (0.00 B/s) - `index.php?ACT=32.1’ saved [0/0]
Coincidentally, if I hit the script directly: http://mysite.com/index.php?ACT=32&hash=7lmuWH8q61Hbq4XCELFvkcwK6UsxrJpo
I get this:
Batch Importing Process Successfully Started
But nothing gets imported.
That looks fine to me. The URL can be accessed and returns a good 200 response. We’re making progress! ![]()
Have you tried a manual import to see if the import even works from the CP?
How about if you load the import URL up in a browser? Accessing the URL should launch the import. Don’t forget that the URL in your latest post only goes through the first 100 rows of data if you have more than that to import
Yup, I’m getting excited and I hope you know how much I appreciate your help!
The import actually works like a charm via manual import via the CP. (Run Now> Run) However, putting the url into the browser returns this successful message: Batch Importing Process Successfully Started but nothing is ever imported into my channel.
Thusly, this is the resulting email:
, 3, 1,
Inventory, channel, csv,
jeramiah@myemail.com, ,
Mon, 27 Feb 2012 14:42:02 +0000, 216.9.179.151, cp, Wed, 31 Dec 1969 17:00:00 +0000, 0, start, 0, 0, 0
Do you have more than 100 rows of data to import?
Have you also run the batch URL a few times? This might be needed to complete the import over all your data