LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   FTP Server Question (https://www.linuxquestions.org/questions/linux-newbie-8/ftp-server-question-395880/)

john lee 12-23-2005 07:18 AM

FTP Server Question
 
Hi all,

We have a few guys in the office who need to upload files regularly to a rather slow ftp server on the Internet.

So, instead of tieing up their client machines to do the upload, I am thinking of setting up an internal ftp server inside the office which they could upload their files quickly. After the files are uploaded, the internal ftp server can then upload all the files to the Internet server slowly on its own.

Are you aware of any such program available or do I have to write my own?

Thanks in advance and have a less stressful Christmas!

farslayer 12-23-2005 08:48 AM

All I see are commercial implementations such as http://www.nubridges.com/solutions/ftp_linux.htm this program can scan a directory and when it sees new files in the directory that can trigger a process to occur, such as uploading the files to another location.
http://www.xellsoft.com/SynchronEX.html
http://www.hiteksoftware.com/ablef/index.htm

I'm sure there are free solutions out there but I'm not finding them at the moment, I'm thinking you could write a script to do this yourself as well..

here's an example I found..
http://www.experts-exchange.com/Oper..._21383832.html
Quote:

Here's a shell script to do the entire thing -- hopefully I've understood all your requirements correctly.

#!/bin/ksh

# This script assumes that the files you want to transfer are in a
# directory called /mypath/mydirectory, the directory you want to archive
# them to is /mypath/myarchivedir, the remote machine you want to connect
# to is called remotehost, your login to that machine is username
# with password password, and you want to put the files in a directory
# called /remotepath/remotedirectory -- you should replace these with
# the appropriate information, of course. It's also assumed that you
# want to transfer/remove ALL files in the source directory.

# All log information for this process is directed to the file
# log$$.log in the /mypath/myarchivedir directory -- $$ is the shell
# variable for the process ID of the current process, so the file will
# be named something like log12345.log. This is a simple way to create
# a fairly unique filename for the log.

# Check to see if the directory is empty by checking to see if the
# result of an ls of the directory is null. If so, write a message
# out to the log and exit.

if [[ -z `ls /mypath/mydirectory` ]]; then
echo "Directory empty, exiting." > /mypath/myarchivedir/log$$.log
exit
fi

# Write the contents of the directory out to the log.
ls -lt /mypath/mydirectory >> /mypath/myarchivedir/log$$.log

# Copy the contents of the source directory to the archive
# directory, using the -p option to preserve file modification times.
cp -p /mypath/mydirectory/* /mypath/myarchivedir

# Connect to the machine remotehost via ftp using these flags:
# -i Turns off prompting so that multiple files can be transferred
# without user intervention.
# -n Turns off checking for automatic logins set up in .netrc.
# -v Turns on verbose mode.
#
# Standard output from the ftp command is appended to the log file;
# standard error is also sent to the log file using 2>&1.
#
# The << symbols after the command indicate the beginning of a "here
# document" -- a section of text that is to be sent to output exactly as
# written. The END after << signifies that the end of the here document
# will be at the next appearance of END.
#
# Within the here document are the commands to be sent to the ftp server:
#
# user username password Logs in to the server as user username
# with password password.
# lcd /mypath/mydirectory Changes to the local directory containing
# the files to be uploaded.
# cd /remotepath/remotedir Changes to the remote directory the files
# are to be transferred to.
# mput * Transfers all files in the current local directory.
# close Closes the connection to the server.
# bye Exits the ftp process.
#

ftp -inv remotehost >> /mypath/myarchivedir/log$$.log 2>&1 << END
user username password
lcd /mypath/mydirectory
cd /remotepath/remotedir
mput *
close
bye
END

# Remove all files in /mypath/mydirectory once they've been transferred.
rm /mypath/mydirectory/*


All times are GMT -5. The time now is 11:44 AM.