Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with shell commands 2

Status
Not open for further replies.

PaulFynch

IS-IT--Management
May 23, 2002
105
CA
Hi all,
Please bear with me, i am new to *nix environments. I am using PuTTY to gain shell access to my server. I have been attempting to run a successful tcp socket server. I have managed to get to the point of finding if the server was running using:

netstat -l

after many error messages of "could not bind to port" etc. I can see my server running under "Active Internet Connections" with a state of LISTEN

How, then, can i stop this server? I assume it has been running for some time and i would like to try and run a newer version.

Thanks again, I appreciate any help.


Cheers,
Paul


"If you build it....it won't work the first time.....or the second ;)
 
Find it's process ID (pid) with "ps" and then "kill" it using that pid.
Then you can re-run it.
If the server process is properly installed as a service then you should be able to start and stop it with the "service" command.


Trojan.
 
Hello trojan,

that's part of the problem, i don't think it has a PID

Here's what i see...


-bash-2.05b$ netstat -lp
(No info could be read for "-p": geteuid()=32034 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:tcpmux *:* LISTEN -
tcp 0 0 *:imaps *:* LISTEN -
tcp 0 0 *:2082 *:* LISTEN -
tcp 0 0 *:2083 *:* LISTEN -
tcp 0 0 *:pop3s *:* LISTEN -
tcp 0 0 *:2084 *:* LISTEN -
tcp 0 0 *:2086 *:* LISTEN -
tcp 0 0 localhost:9090 *:* LISTEN - <<<this one's mine
tcp 0 0 *:mysql *:* LISTEN -

there is no PID for the service, but i will look more into the service command

thnks
paul

"If you build it....it won't work the first time.....or the second ;)
 
furthermore i think it absolutely is *not* properly installed

i uploaded the php script to my webserver and run it from the bash prompt

php myserver.php

and it actually seems to hang there

but netstat confirms the service is running on the port i specify, i just need to figure out how to stop it (for debugging purposes)

thx
paul

"If you build it....it won't work the first time.....or the second ;)
 
All processes have to have some kind of process ID. I can't imagine why netstat is not reporting it but you could also try "top" to see what's running.


Trojan.
 
hey trojan,

netstat reports it fine, ps does not. in fact, ps shows there are very little processes running on the webserver.

here is the information i have about the machine (cpanel)

Operating system Linux
Service Status Click to View
Kernel version 2.4.20-28.9
Machine Type i686
Apache version 1.3.33 (Unix)
PERL version 5.8.1
Path to PERL /usr/bin/perl
Path to sendmail /usr/sbin/sendmail
Installed Perl Modules Click to View
PHP version 4.4.0
MySQL version 4.0.22-standard
cPanel Build 10.2.0-STABLE 83
Theme cPanel X v2.5.0


ps returns this...

-bash-2.05b$ ps
PID TTY TIME CMD
30241 pts/1 00:00:00 bash
30271 pts/1 00:00:00 ps

netstat:

-bash-2.05b$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:tcpmux *:* LISTEN
tcp 0 0 *:imaps *:* LISTEN
tcp 0 0 *:2082 *:* LISTEN
tcp 0 0 *:2083 *:* LISTEN
tcp 0 0 *:pop3s *:* LISTEN
tcp 0 0 *:2084 *:* LISTEN
tcp 0 0 *:2086 *:* LISTEN
tcp 0 0 *:2087 *:* LISTEN
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 localhost:9090 <<<< (MINE) *:* LISTEN
tcp 0 0 *:55659 *:* LISTEN
tcp 0 0 *:55790 *:* LISTEN
tcp 0 0 *:pop3 *:* LISTEN
tcp 0 0 localhost:783 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:2095 *:* LISTEN
tcp 0 0 *:imap *:* LISTEN
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:2096 *:* LISTEN
tcp 0 0 *:smtps *:* LISTEN
tcp 0 0 *:57972 *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 65.39.215.203:domain *:* LISTEN
tcp 0 0 65.39.214.68:domain *:* LISTEN
tcp 0 0 65.39.214.18:domain *:* LISTEN
tcp 0 0 65.39.215.107:domain *:* LISTEN
tcp 0 0 65.39.215.98:domain *:* LISTEN
tcp 0 0 koi.host-servers:domain *:* LISTEN
tcp 0 0 localhost:domain *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:55607 *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
tcp 0 0 localhost:rndc *:* LISTEN
tcp 0 0 *:https *:* LISTEN


...etc (udp after that)

when i do a netstat -lp it shows no PID with ANY of the tcp services
so how can i shut one of them down? this is not my server so i don't have the option of sitting at the machine, and i don't want to compromise any one else's stuff, lest my host determine my activities as "malicious" and revoke my privaleges.

Thanks again
Paul

"If you build it....it won't work the first time.....or the second ;)
 
And what about this ?
ps -fe

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
okay...
tried that one, it spit out a whole pile of stuff, but i don't see the service i am looking for...

i'd post the output, but its reeeeeeally long

thx
paul

"If you build it....it won't work the first time.....or the second ;)
 
-bash-2.05b$ netstat -lp
(No info could be read for "-p": geteuid()=32034 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:tcpmux *:* LISTEN -
tcp 0 0 *:imaps *:* LISTEN -
tcp 0 0 localhost:9090 *:* LISTEN -
tcp 0 0 *:2082 *:* LISTEN -
tcp 0 0 *:2083 *:* LISTEN -
tcp 0 0 *:pop3s *:* LISTEN -

etc

mine is the 9090
p

"If you build it....it won't work the first time.....or the second ;)
 
PHV

I posted the output from the "ps -fe" here....


i don't see the service im lookin for...


thx guys
pf

"If you build it....it won't work the first time.....or the second ;)
 
And what about lsof ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV

Code:
-bash-2.05b$ lsof
-bash: lsof: command not found
-bash-2.05b$
*shrugs*
pf

"If you build it....it won't work the first time.....or the second ;)
 
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 
Thank you, everyone, for your help, i have (it seems) resolved this problem, and created new ones.

Actually Tech support at OnSmart.net resolved it

It appears this is just a case of me not knowing wtcrapola im doing.

so the script does run, i had just assumed that because nothing happened after i typed the command that it wasn't working. I had been hitting Ctrl+C to break the script because i expected to return to the prompt (or 'a' prompt) after i ran it (being dos-native).

All of your recommendations for commands to the shell work fine, it was my fumbling through linux that caused all this.

Again thanks for your time and effort, the information you have shared will not be wasted ;)

Cheers,
Paul

PS, i wish to give PHV the star for your time and effort. Thanks again

"If you build it....it won't work the first time.....or the second ;)
 
oops, sorry, Trojan gets a star too ;)

(boy its late, I just crawled into bed and my Blackberry went off when tech support emailed so i thought, man they haven't got back to me all day, i better go talk to them, i might not get another chance)

Back to bed, and thanks again!
cheers,
paul

"If you build it....it won't work the first time.....or the second ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top