Thursday, May 17, 2012

apache running services - lt-httpd -k start -DSSL

a weird case i ever experience today, maybe it sounds weird to me only.
a normal running apache server would have the following output(Output1), when you run linux command shell> ps -ef | grep httpd

Output1:
root      1373     1  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
apache    1375  1373  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
apache    1376  1373  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
apache    1377  1373  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
apache    1378  1373  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
apache    1379  1373  0 15:34 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL
root      1387 26065  0 15:34 pts/6    00:00:00 grep httpd


My Case:
However, i only have following output (Output2), when i run linux command shell> ps -ef | grep httpd

Output2:
apache   30008     1  0 Mar27 ?        00:00:00 /usr/sbin/.libs/lt-httpd -k start -DSSL


When i try to restart the apache server via command shell> /sbin/service httpd restart 
i get the following error show (Output3),

Output3:
Stopping httpd:                                            [FAILED]
Starting httpd: [Thu May 17 14:47:56 2012]
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs


Solution:
The lt-httpd service is part of the Apache server's service, hence i make up the decision to kill the process shell> kill 30008
After the process being killed, i'm able to start and stop my apache server again.

Explanation:
The reason of why only one and the only "/usr/sbin/.libs/lt-httpd -k start -DSSL" in the services list, if because due to the incomplete startup of the apache server after the physical server restart. Which then had causing the port 80 being hold by the handicapped apache service.
Because the restart features of the apache not able to shutdown the handicapped apache service, hence it always throw exceptions/error when you trying to restart/stop the apache server.

*Welcome any comments to share your point of view. Thanks very much.







Wednesday, May 9, 2012

how to check in linux if port is occupied?

shell> netstat -a | grep <portno>

result should be somethings similar as following
_________________________________________________________________________________
unix  3      [ ]         STREAM     CONNECTED     3821446054 /var/run/dovecot/login/default
unix  3      [ ]         STREAM     CONNECTED     3821446052
unix  3      [ ]         STREAM     CONNECTED     3821446037
unix  3      [ ]         STREAM     CONNECTED     3821446036
unix  3      [ ]         STREAM     CONNECTED     3821442460 /var/run/dovecot/login/default
unix  3      [ ]         STREAM     CONNECTED     3821442450
unix  3      [ ]         STREAM     CONNECTED     3821442430
unix  3      [ ]         STREAM     CONNECTED     3821442429
________________________________________________________________________________