- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script to login to ftp and check
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
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
тАО11-28-2005 05:45 PM
тАО11-28-2005 05:45 PM
script to login to ftp and check
Like the script has to login to the ftp site with corresponding username and password. If ftp have any issues while executing the script, script suppose to throw the message with corresponding issue(eg : problem with port or problem server or etc).
Thanks
Yuva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2005 05:49 PM
тАО11-28-2005 05:49 PM
Re: script to login to ftp and check
ftp -i -n
user
ls
mget
!ls
EOF
You can check script results as echo ${?} after EOF statement.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2005 05:51 PM
тАО11-28-2005 05:51 PM
Re: script to login to ftp and check
user
ls
mget
!ls
EOF 1>/tmp/output.log 2>/tmp/error.log
if [[ ${?} -eq 0 ]]
then
echo "FTP: Success $(date)"
else
echo "FTP: Failure $(date)"
fi
You can view /tmp/output.log for STDOUT messages and /tmp/error.log for STDERR informations like problem with port or connectivity problem.
PS: Change the commands you want to execute there.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2005 06:03 PM
тАО11-28-2005 06:03 PM
Re: script to login to ftp and check
# echo bye |ftp -i localhost
ftp: connect: Connection refused
# echo $?
0
You should use the log file created as described above and find for a "transfer ok" message. The message vary depending of the ftp server.
For example, for vsftpd:
227 Entering Passive Mode (127,0,0,1,75,234)
150 Opening BINARY mode data connection for file (0 bytes).
226 File send OK.
So, the verification should be something like:
CORRECT=`grep -w OK $LOGFILE |wc -l`
if [ $CORRECT = 1 ]; then
echo "Transfer correct"
else
echo "There was a problem with the file transfer, check $LOGFILE"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 11:30 PM
тАО11-29-2005 11:30 PM
Re: script to login to ftp and check
ftp -i -n 192.0.0.1 <<-EOF
user anonymous anonymous
ls
EOF
This is the script I have used to test. But it is getting hang. so I have killed the process. I hope as per the script it won't take the plain password. Some one please write the script and test it and let me know. It would be great help for me.
Thanks
Yuva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 11:35 PM
тАО11-29-2005 11:35 PM
Re: script to login to ftp and check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 12:30 AM
тАО11-30-2005 12:30 AM
Re: script to login to ftp and check
ftp -i -n 192.0.0.1 <<-EOF
user anonymous anonymous
ls
bye
EOF
I am using the above script. Still it is get hang. Please check your system and let me know.
Thanks
Yuva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 12:34 AM
тАО11-30-2005 12:34 AM
Re: script to login to ftp and check
Ensure that the last EOF is not indented.
#!/bin/bash
ftp -i -n 192.0.0.1 <
ls
bye
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 08:08 PM
тАО11-30-2005 08:08 PM
Re: script to login to ftp and check
ftp<<**
open 192.1.1.1
anonymous
ls
**
The above script is working. But It is asking the password while executing the script. When I mentioned the password in the script is not taking.It seems we need to give the password at the time of executing the script.
Please check the same and let me know. I donn't want to enter the password manually. we need to mention the password in the script and it suppose to take the password while executing the script. Please suggest the same.
Thanks
Yuvaraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 08:37 PM
тАО11-30-2005 08:37 PM
Re: script to login to ftp and check
ftp -i -n 192.1.1.1<<**
user anonymous
ls
**
It will take. If you use open then it will prompt for username and password.
Use the ftp script in my prev. threads.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 10:21 PM
тАО11-30-2005 10:21 PM
Re: script to login to ftp and check
user anonymous anonymous
ls
**
It is getting hand. Please check and let me know.
Thanks
Yuva