Re: get the number of user
From: Chris F.A. Johnson (c.f.a.johnson@rogers.com)
Date: 04/08/03
- Next message: Chris F.A. Johnson: "Re: feeding data to a program"
- Previous message: darshan: "sed, awk, perl"
- In reply to: Jun: "get the number of user"
- Next in thread: William Park: "Re: get the number of user"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Chris F.A. Johnson" <c.f.a.johnson@rogers.com> Date: 8 Apr 2003 05:10:41 GMT
On Tue, 08 Apr 2003 at 04:14 GMT, Jun wrote:
> thanks.
> I am installing now.
> actually, I have one more question.
>
> wrote server and client program like these:
What server program?
> #!/bin/sh
>
> echo "There are `who | wc -l` users on this system."
This just tells you how many people are on the machine that's
running the script, not a remote computer.
> client program:
> #!bin/sh
>
> if [ $# = 1 ]
> then
> echo "You need one argument : file "
> exit 1
> fi
>
> cmd=$0
> filename=$1
>
> while read -r address
> do
> array[0]=$address
What's the array for? You don't use it.
> telnet $address 80 | myserver
What is this supposed to do?
> done < $1
>
> also, the hostaddress.txt is
> www.yahoo.ca
> www.cbc.ca
> www.sasktel.com
> www.shaw.ca
> www.google.ca
> www.hotmail.com
> www.futureshop.ca
> ca.msn.com
> www.ebay.ca
> www.expedia.ca
> www.zdnet.com
> www.cnn.com
>
> after I executed the client program,
> I got this result each hostaddress.
>
> array[0]=www.yahoo.ca
> "There are 2 users on this system
Because you are not running the "server" on the remote machines;
you are running it on your local box. You are trying to pipe the
output of the telnet command into th estdin of your script ON YOUR
LOCAL COMPUTER, and the script doesn't read stdin.
Even if it did, telnet command is not going to produce anything;
how are you giving it a login name? How are you giving it a
password?
What makes you think you can get a telnet connection to a web
server?
> what was wrong?
It would be quicker to ask what is right.
Did you read any of the earlier replies to your posts?
What part of Barry's reply did you not understand?
To refresh your memory, here is an abbreviated version of what he
told you:
> You can't find out how many users are logged into a web site.
> You can't find out how many users are logged into a web site.
Get it?
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Chris F.A. Johnson: "Re: feeding data to a program"
- Previous message: darshan: "sed, awk, perl"
- In reply to: Jun: "get the number of user"
- Next in thread: William Park: "Re: get the number of user"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|