- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: FTP Question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 10:11 AM
12-09-2002 10:11 AM
FTP Question
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 10:20 AM
12-09-2002 10:20 AM
Re: FTP Question
#!/bin/ksh
ftp -n
user
bin
prompt
mput *
FTP
-USA..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 10:26 AM
12-09-2002 10:26 AM
Re: FTP Question
any time I need to update it
# /usr/bin/ksh
for x in `more /home/root/list`
do
echo CONNECTING TO $x
ftp -n <<-EOF
open $x
user
cd /etc
put /etc/hosts
chmod 644 /etc/hosts
quit
EOF
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 10:44 AM
12-09-2002 10:44 AM
Re: FTP Question
ftp -i -v $TARGET_HOST <<-/* >$FTPLOG 2>&1
put $FILE $TARGET_DIRECTORY/$FILE (REPLACE
quit
/*
you will need to create a ".netrc" file on the target machine's user's home directory (the user running the ftp script). See the man page on netrc. example .netrc for user named goofy:
machine target_host login goofy password funny
The UNIX user name "goofy" has a password of "funny". The perms on .netrc MUST be 400.
The ftp log file is in "$FTPLOG"
Just keep doing "put"s in the /* /* construct
above and end the ftp session with the "quit" above. You will want to do some preliminary checks like ping the target server to see if it is alive, and process the $FTPLOG for errors after the script is run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 11:00 AM
12-09-2002 11:00 AM
Re: FTP Question
Use if like this:
ftp.pl file1 file2 file3
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "FTP ok"
else
echo "FTP Bad; result ${STAT}"
fi
It will automatically log you in and transfer the files for you and actually attempt to repeat a failed xfer.
I never try to do FTP stuff in the shell anymore; the Perl solution just works too well.