Operating System - HP-UX
1748208 Members
2791 Online
108759 Solutions
New Discussion юеВ

How to report disk space availability at remote location within ftp session?

 
SOLVED
Go to solution

How to report disk space availability at remote location within ftp session?

While ftp'ing to a remote server, how can I display disk space availablilty & usage of the remote location.

Traditional hp-ux commands were unsuccessful while engaged in ftp session i.e. du -f; bdf; bf
7 REPLIES 7
curt larson_1
Honored Contributor

Re: How to report disk space availability at remote location within ftp session?

have you tried the following:

![command [args]]
Invoke a shell on the local host. The SHELL environment variable specifies which shell program to invoke. ftp invokes /usr/bin/sh if SHELL is undefined. If command is specified, the shell executes it and returns to ftp. Otherwise, an interactive shell is invoked. When the shell terminates, it returns to ftp.

Re: How to report disk space availability at remote location within ftp session?

Hey Curt

Thanks for the info; however, it invokes the shell on the local host - I would like to execute shell commands on the remote host to obtain my disk space data.

Point of clearification - it is the remote site disk info that I am trying to obtain within my ftp session. I would like to get the total space allocated and space used or percent used of the remote location - I only have access to this remote box via an ftp session from my machine. I can not just telnet or rumba my way into this remote box.

curt larson_1
Honored Contributor

Re: How to report disk space availability at remote location within ftp session?

If the first character of the file name is |, ftp interprets the remainder of the argument as a shell command. ftp forks a shell, using popen() (see popen(3S) ) with the supplied argument, and reads (writes) from standard output (standard input). If the shell command includes spaces, the argument must be quoted, as in:

"| ls -lt".
curt larson_1
Honored Contributor

Re: How to report disk space availability at remote location within ftp session?

Some useful examples of this mechanism are:

ls . "| more".



The above command lists the files in the current directory page by page.

put "| tail -20 loc_file" rem_file.
Con O'Kelly
Honored Contributor

Re: How to report disk space availability at remote location within ftp session?

Hi Brian

My understanding is that you cannot do this from within an ftp session.
A man on ftp will show you all the commands available from within an ftp session.

You'll need some sort of access to the server (telnet, remsh, ssh) to be able to get this info.

Maybe others will have a better idea. I understand Curt's thinking but can you show an example of using the bdf/du command?

Cheers
Con
Bill Hassell
Honored Contributor
Solution

Re: How to report disk space availability at remote location within ftp session?

Remote ftp commands are extremely limited. Depending on how the sysadmin for the remote system setup ftp, you not have access to any remote commands. ftp is not a shell and does not login in the same manner as telnet. Some ftp servers will allow the QUOTE and/or the SITE command. Try this while connected in ftp:

site exec /usr/bin/bdf

But if the remote ftp server does not allow SITE EXEC commands, then you're out of luck and you'll have to call someone to tell you what bdf shows. The man page for ftpd gives the possible SITE commands (but may be overriden by ftpd config files)


Bill Hassell, sysadmin
malay boy
Trusted Contributor

Re: How to report disk space availability at remote location within ftp session?

! debug mget put size
$ dir mkdir pwd status
account disconnect mls quit struct
append form mode quote system
ascii get modtime recv sunique
bell glob mput reget tenex
binary hash newer rstatus trace
bye help nmap rhelp type
case idle nlist rename user
cd image ntrans reset umask
cdup lcd open restart verbose
chmod ls prompt rmdir ?
close macdef proxy runique
cr mdelete sendport send
delete mdir passive site


Above is only command which be executed inside ftp.

I don't think you can do that.

May be other's sifu have any idea which I loved to know also.

regards
mB
There are three person in my team-Me ,myself and I.