Jump to content

Cronjob stripping url


Go to solution Solved by 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
Edited by jazzman1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.