Hi,
I'm trying to write a shell script that do ftp and download file periodically, this script should be called by a daemon running in the background.

the shell script "script.sh" is as follows: yafc [url]ftp://test:test@192.168.1.225:21[/url] < commands and the "commands" files is

d Root/md5* /
quit

if I run script.sh it will work just fine.
But when the daemon software calls the "script.sh", the script will send ftp login request to the ftp server, but will not even answer the username or anything.

I believe it is something about child process redirection, but I don't know how to deal with it.

This problem is not only with yafc, it is the same with any ftp client or any application like telnet and so.

can you help?
Thanks !

Recommended Answers

This is just a guess. Try (yafc [url]ftp://test:test@192.168.1.225:21[/url]) < commands . The parens make the enclosed command(s) run in a sub process together which may work as you wish.

Jump to Post

All 2 Replies

Interesting, Thanks for the help, I'll try it.
so far I found that the daemon closes all stdin stdout stderr before it makes the call to the shell script.
after openning the std I/O, it worked fine, on drawback is that I can see all the messages no the console screen.
I hope this will not be buffered after I log out from telnet.

Thanks for the help again !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.