Jump to content

Shell script and Cron


Recommended Posts

Hi there,

 

I have a script that pulls in a weather feed via FTP then writes the output to a file.

This script is run everyday at 3pm by cron.

 

Heres the shell script:

 

#!/bin/sh
HOST='ftp.weatheronline.co.uk'
USER='my username'
PASSWD='my password'
FILE='/var/www/vhosts/mysite.com/httpdocs/_shell/weatherfeed.csv'

touch $FILE

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
get $FILE
quit
END_SCRIPT

 

and the cron job

 

* 12 * * * /var/www/vhosts/mysite.com/httpdocs/_shell/getweatherfeed

 

And when the cron runs I receive the following error:

 

local: ./var/www/vhosts/mysite.com/httpdocs/_shell/weatherfeed.csv: No such file or directory

 

Im just confused why the script is not running as it should. The permissions on the folder _shell is 777.

Any help is much appreciated! I've been stuck on this problem for 2 days now  :'(

Link to comment
Share on other sites

Firstly I shall presume that you have put "mysite.com" to prevent spam and that in your real shell script you have put the proper one.

 

My second question, although maybe obvious, is does the file exist inside the folder? "No such file or directory" is generally when a file or folder is not located where you tell it to be? So have you tried navigating to that file manually? If that works then I am lost :(

 

Also the folder being 777 doesn't mean the file is 777 ;)

Link to comment
Share on other sites

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.