We make tools that make websites.

Forums (Archived)

The Solspace Support Forums are now CLOSED (read-only)

Check out our new support options here. Please refer to this blog post for more information.

   

Unsure about Cron

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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.shNo 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 

Image Attachments Click thumbnail to see full-size image

2-25-2012 2-17-21 PM.jpg
Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

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. smile

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)

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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.shline 1: /usr/local/bin/wgetNo such file or directory 

Image Attachments Click thumbnail to see full-size image

2-27-2012 11-07-54 AM.jpg
Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

Alright, I see that that you changed the paths, that’s good smile 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? smile

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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!!

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

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 grin).

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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.

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

The scripts look fine from what I see then. smile
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?

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

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? smile

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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!

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

Sounds good, let us know how that goes smile

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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.

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

That looks fine to me. The URL can be accessed and returns a good 200 response. We’re making progress! grin
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 wink

Signature

RankRankRank

Total Posts: 351

Joined: Mar 28, 2009

PM

Ignore

 

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

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

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 smile

Signature