cancel
Showing results for 
Search instead for 
Did you mean: 

ftp per shell script

thk
Champ on-the-rise
Champ on-the-rise
Hi
I want to transfer a file per ftp to alfresco:

My shell script (called hourly from crontab):

ftp -n HOST < /tmp/ftp.input

the file ftp.input contains:

user LOGIN PASSWORD
cd subdirectroy
binary
put /Path/File
bye

If I just use ftp from command line I can put the file without problems but running the shell script aI get the error "command not recognized" when trying executing the put-command. I used the absolute path to File for put .

Is there anything special with ftp to alfresco, why its not working?

Thanks for help
Thomas
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
No there's nothing special.

The problem will probably be due to the different environment from running your script from your shell or via crontab.  From what you have posted I suspect that the ftp command is not on the path when used from crontab.   Try making the ftp command absolute.

thk
Champ on-the-rise
Champ on-the-rise
Hi ,

my script:
ftp -n HOST < /tmp/ftp.input
my exact ftp.input-file:
user admin admin
cd subdirectory
binary
put trigger_rules_execution
bye

running from crontab I get in /var/mail/root:

ftp: local: trigger_rules_execution: No such file or directory

running the script manually: ./script
I get :

Connected to 191.168.78.249.
220 FTP server ready
331 User name okay, need password for admin
230 User logged in, proceed
Remote system type is UNIX.
250 Requested file action OK
200 Command OK
local: trigger_rules_execution remote: trigger_rules_execution
522 Command not recognized
227 Entering Passive Mode (191,168,78,249,186,212)
150 File status okay, about to open data connection
226 Closing data connection
221 Bye

Whats strange: if I run ftp from command line with  ftp <user>@<ip> the same put in the alfresco space works .
If I change the ip to another server (ftp put to a normal linux directory instead of to alfresco) and run the scripts the put also works with the script.
So where is the problem? The script seems to be ok (it works with a normal ftp transfer) and its also possible to transfer to the alfresco space with the user on command line but not using the script.

Appreciate any advice!