Jump to content

Cronjob stripping url


oracle765

Recommended Posts

HI Professionals

 

I have a cron job (attached) which runs a .sh script (attached) to download a csv file from an affiliate.

 

Problem is in the URL part it comes across the $ sign within the url and cuts part of the url away so I only receive a blank empty file.

 

I have also attached the results from the cronjob any ideas whats going wrong as when I paste the url into the browser there is obviously nothing there because it has been chopped

Link to comment
https://forums.phpfreaks.com/topic/285190-cronjob-stripping-url/
Share on other sites

$blah is treated as a variable and the shell replaces it with that variables value (or the empty string if undefined).

 

You need to prevent the shell from seeing it as a variable, the easiest way to do so in your case is to simply quote the URL using single-quotes rather than double-quotes.

Hi Kicken

 

that's brilliant that works thanks very much, however I am now faced with another problem.

 

Because the files are in .GZ format I cant seem to unzip them I get an error message as shown in the new attached file saying

 

gzip: invalid suffix ''

feedimport.txt

@oracle765, type into terminal - man gzip and look at examples.

 

I looked at the log of your last attached file and saw this line, which is apparently wrong.

/usr/bin/gzip -c -d -S "" /home/oracle765/public_html/feed/crazysales.csv.gz > /home/oracle765/public_html/feed/crazysales.csv

If you want to unzip the file named "crazysales.csv.gz" and redirect the output to new one named crazysales.csv, try next:

/usr/bin/gzip -c -d  /home/oracle765/public_html/feed/crazysales.csv.gz > /home/oracle765/public_html/feed/crazysales.csv

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.