LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2005, 06:36 AM   #1
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Rep: Reputation: 30
httpd restart headache; netstat


recently 2 of my webservers had this problem

Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:443
no listening sockets available, shutting down
Unable to open logs


Couldn't restart the service. So i reset the first one.

Did a bit of search, found out abt 'netstat', so i ran netstat -tlnp egrep 443 and found out a process "httpd -dssl" is running.

I kill -9 processid and started the service again, it work....


solve all this by googling, so alot of unknowns in my head

1) What cause the root of the problem (address already in use etc...)

2) for netstat what does -tlnp refers too? and why egrep? what's the difference between egrep and grep?

3) what's httpd -dssl refering to? how come it will hold the process such that httpd itself cannot restart?

4) what's the purpose of using "kill -9 processid" to stop process?



For netstat.. i suppose this tool is meant more for listening on certain ports, to see if the service is actively listening.. am I right?

What's the best way to use it to get comprehensive information enough to helpful data?

For the httpd error, i can't find any error in the log; i suppose since it says fail to open log... that's why?


Some of them i did a --help.. couldn't really understand so thought you guys can enlighten me...

it caused a short panic but whew... all's well after some googling

thanks man!



 
Old 10-25-2005, 08:08 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
1) Assuming you hadn't previously started httpd manually it is likely an automated start script.
Do "cd /etc/init.d" then "grep httpd *" This will show you which start script is starting it automatically. (There is an internal web server for documentation that can be autostarted.)

2) All commands have manual pages (called "man pages" for short). You should be able to find out what each option does by typing "man netstat". In Unix/Linux options can be combined so "-tlnp" actually means "-t & -l & -n & -p" so you'd need to take a look at each of these. FYI: netstat won't show the process - it just shows open connections - you need a tool like lsof to see processes. It appears you got lucky because your port (see /etc/services) and your process had similar names - they won't always.

3) Network processes start on a "port". A network connection is actually a combination of IP address AND port. You can see many ports defind in the /etc/services file. Most services live on "well defined ports". Since 443 is one of these any httpd process will initially go there so you can't run a second httpd if the first one is running there. Other ports for web services are 80 (root) and 8080 (non-root).

4) kill -9 is a LAST RESORT. The -9 (aka SIGKILL) means "Stop the process now without waiting for cleanup" and by definition can't be trapped. (Do "man signal" for more details on signals.) "kill" is a a command you use to send a signal so is really misnamed except when it does "kill -9" which is a true kill. When you want to kill a process you should try progress kill:
kill (or kill -15) PID
If that doesn't work:
kill -1 PID
And only if that doesn't work:
kill -9 PID.

As you note running a command with --help typically will give you usage information (sometimes running with no flags at all does if it requires them). However you don't KNOW that is an option so it could be dangerous to try it on commands you're not familiar with.

"man COMMAND" exists for almost every Unix/Linux command. As noted earlier this is the document that gives you details about the command as well as options (including --help) that are available.

"info COMMAND" exists for almost every Linux (but not Unix) command. This may have a more comprehensive document than "man" or at the very least will show the info you would have gotten with "man COMMAND".

So for your questions try:
"man netstat"

"man kill"

"man signal"

"man ps"

"man man"

FYI: Most "man" pages have a "SEE ALSO" section at the bottom. If you still have questions after reviewing the man page doing a "man" on the items mentioned in SEE ALSO may give you more detail. The SEE ALSO will usually show something like COMMAND(NUMBER) - the "NUMBER" is the section of the man pages it is in - when you type man on the command you type "man NUMBER command" to see the specified command in the specified section. Most commands only exist in one section so you don't need the NUMBER but some do exist in more than one section so you do.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed Httpd restart namboi Linux - Newbie 5 05-07-2005 07:23 PM
deleted httpd.conf - apache still finds it after restart jordanthompson Linux - Software 1 10-16-2004 02:08 PM
httpd daemon needs frequent restart to work properly sushil_deore Linux - Software 0 09-16-2004 07:35 AM
service httpd status, results in httpd dead but subsys locked squadja Red Hat 2 09-11-2004 10:31 PM
Command to restart httpd service deWin Linux - Software 2 07-13-2004 06:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration