When i run this command
sudo /etc/init.d/httpd restart
it gives below error
Stopping httpd: [FAILED]
Starting httpd: (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 [FAILED]
i checked running programs at port 80 by using
netstat -lnp | grep :80 (it gives below output)
tcp 0 0 :::80 :::* LISTEN 21739/httpd
why i am not able to stop stop apache by using sudo /etc/init.d/httpd restart?
below commands work without issue
sudo apachectl stop
sudo apachectl start
i am using linux micro instance of amazon ec2
I ran into this problem when I installed apache from source, but then tried to run
$ sudo /etc/init.d/httpd restart
which was using a pre-installed version of apache. The stop directive in /etc/init.d/httpd was not removing the httpd.pid file that was created when starting the source-installed version of apache.
To determine if this is also the reason for your problem, find where the httpd.pid file is getting set when you run
$ sudo apachectl start
If you installed from source and apache2 is living in /usr/local/apache2, then the httpd.pid file should get created in /usr/local/apache2/logs. When you stop apache by running
$ sudo apachectl stop
this file should get removed. So to test if the httpd.pid file is causing your problem, start apache by calling
$ sudo apachectl start
and locate the httpd.pid file. Then try stopping apache by using
$ sudo /etc/init.d/httpd stop
If the original httpd.pid file is still present, then that is why apache is unable to start when you use
$ sudo /etc/init.d/httpd start
To get my /etc/init.d/httpd file to work correctly, I explicitly put the call to apachectl in the start and stop methods:
#!/bin/bash
# /etc/init.d/httpd
#
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
pid=/usr/local/apache2/logs/httpd.pid
prog=httpd
RETVAL=0
start() {
echo -n $"Starting $prog: "
$apachectl -k start
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
$apachectl -k stop
RETVAL=$?
echo
}
I tried this and it works:
sudo fuser -k -n tcp 80
sudo service httpd start
Hope this will help you!
Cheers
I feel its better to kill the process itself, find out the process id and kill it and then do a fresh start, it should work fine
I have had this issue very rarely over the last couple years with a server I've been managing. Unfortunately, if you are getting FAILED after trying to restart, the process that's managing the connection on port 80 won't release it's hold on that port.
I would try a full "sudo /etc/init.d/httpd stop" wait for that to finish or fail.
If that doesn't fix it you'll have to restart the server completely. Hopefully, it's configured to start everything up automatically on restart, but that isn't guaranteed.
"apachectl" is also great tool for Apache, but it may not be on this server, it depends on the install and linux distro used.
If after rebooting the server, apache still fails to start, something bad has happened. I'd consider pulling all the website and conf files for creating a new server at that point, but the apache start, and then failed message output should give you some idea of where to look in the Logs about why it cannot start.
Related
I'm going through this tutorial
making docker image with: docker build -t myapp_back .
and then want to run container with: docker run -p 3000:3000 -d myapp_back
it's simlpe node/express app
But I'm getting an error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error
response from daemon: driver failed programming external connectivity
on endpoint wizardly_wescoff
(a7c53e0d168f915f900e3d67ec72805c2f8e4f5e595f6ae3c7fed8e097886a8b):
Error starting userland proxy: mkdir
/port/tcp:0.0.0.0:3000:tcp:172.17.0.2:3000: input/output error.
What's wrong?
my dockerfile:
FROM node:carbon
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ['npm', 'start']
and start in package.json:
"start": "nodemon src/app.js --exec babel-node"
To solve the following error in Windows: just Restart Docker (from tray menu or selecting the 'Restart Docker...' option in Settings/Reset)
Cannot start service YOUR_SERVICE: driver failed programming external connectivity on endpoint ...
Looks like it is a known issue from docker: https://github.com/docker/for-win/issues/573
Try:
disabling "Experimental Features" in the Settings/Daemon menu
restarting docker
stopping all containers.
To stop all containers, run: docker ps -a -q | ForEach { docker stop $_ }
EDIT: Working ShellScript code to Stop All Containers
for a in `docker ps -a -q`
do
echo "Stopping container - $a"
docker stop $a
done
Just restarted my computer and it works now..
I am able to get docker working on my windows 10 pc by resetting docker to the factory defaults. Restarting docker, restarting my machine did not work.
On Mac Mojave, run the following command to find which processes are using the port.
sudo lsof -i #localhost:<port_no>
In my case I was checking port 8080 so I run
sudo lsof -i #localhost:8080
I found that the http-alt is running on port 8080 and after getting the process id using above command you can kill the processes by
sudo kill -9 <process_id>
However, in my case four applications ArtemisSe, Mail, Google and Slack are using http-alt on port 8080. Since they look important applications so I changed my port and run the container on 8888 instead of 8080. i.e.
docker run -it --rm -p 8888:8080 <imageid or image name>
Restarting the computer is not the actual fix, just a workaround, that one would need to be doing on a frequent basis.
The problem is related with the default windows 10 shutdown behaviour.
The actual fix can be achieved disabling windows fast startup settings:
Control Panel -> Power Options -> Choose what the power button does -> Change settings that are currently unavailable -> Toggle Turn on fast startup
I am running under linux. If I run docker as root with the sudo command, it works fine.
Just restart docker, right click on its icon then restart. that solved my problem
In my case, the same error in PHP Container. I solve changing the public port and works.
This command throw error after restart my Windows 10:
docker run -d -p 8080:80 --name php_apache php_app
Solution:
docker run -d -p 8081:80 --name php_apache php_app
Just run this command to stop your all containers
It worked for me.
for a in docker ps -a -q
do
echo "Stopping container - $a"
docker stop $a
done
In some case,restarting your computers solve problem. But it is not really best solution, especially UNIX like operation system.
First of all you should know other process is either running or not in specific port, If you see such port is already in use by other resources. you should kill that procees which running in that port. To do that just follow:
sudo lsof -i #localhost:<port number>
Output looks like this
Command PID USER TYPE SIZE ...
<command> <pid number>
We need pid number which is defines procees id
And then kill that process by its procees id
sudo kill -9 <pid>
After kill that procees you can run your new container in such port as you want
I'm looking to understand how running the command "sudo /sbin/service --status-all" on a RedHat 6.7 64bit system could restart Apache?
I've always used this command to list all running and stopped services, this is the first time I've seen it restart a service though. Is this down to a bad Apache config or can issuing this command restart services in certain circumstances?
Update:
The status of httpd is that it is stopped:
sudo /etc/rc.d/init.d/httpd status
httpd is stopped
sudo /etc/init.d/httpd status
httpd is stopped
If I run "sudo /sbin/service --status-all" I see:
X is installed
Y is running...
X is stopped
httpd (pid xxx) already running
root xxx 1 0 18:10 ? 00:00:00 /usr/sbin/httpd -f
/httpd.conf -k start
I have a Python pyramid application that I am running using uwsgi like so:
sudo /finance/finance-env/bin/uwsgi --ini-paste-logged /finance/corefinance/production.ini
Once it's running and my window times out, I am unable to stop the server without rebooting the whole box. How do I stop the server?
You can kill uwsgi process using standard Linux commands:
killall uwsgi
or
# ps ax|grep uwsgi
12345
# kill -s QUIT 12345
The latter command allows you to do a graceful reload or immediately kill the whole stack depending on the signal you send.
The method you're using, however, is not normally used in production: normally you tell the OS to start your app on startup and to restart it if it crashes. Otherwise you're guaranteed a surprise one day at a least convenient time :) Uwsgi docs have examples of start scripts/jobs for Upstart/Systemd.
Also make sure you don't really run uwsgi as root - that sudo in the command makes me cringe, but I hope you have uid/gid options in your production.ini so Uwsgi changes the effective user on startup. Running a webserver as root is never a good idea.
If you add a --pidfile arg to the start command
sudo /finance/finance-env/bin/uwsgi --ini-paste-logged /finance/corefinance/production.ini --pidfile=/tmp/finance.pid
You can stop it with the following command
sudo /finance/finance-env/bin/uwsgi --stop /tmp/finance.pid
Also you can restart it with the following command
sudo /finance/finance-env/bin/uwsgi --reload /tmp/finance.pid
I've installed ElasticSearch and Kibana edge versions on a Ubuntu Linux 14 box. So that's Kibana 4 on ElasticSearch 1.4.4.
Runs and works like a charm through: ./bin/kibana
However, as soon as I disconnect my Putty session, Kibana stops working. ElasticSearch keeps listening on port 9200, but Kibana cannot be reached at 5601 anymore.
Difference seems to be that Kibana runs in the 'foreground' - since as soon as you run it - you see log messages flying by all the time. Using -q will make it quiet indeed - but not run in the background.
So I read somewhere that running it in the background might work: ./bin/kibana &. It doesn't. Neither does CTRL-Z and then bg work.
So maybe, the reason is that I run Kibana under the logged in user and when I log out, it kills all processes of that user. So I tried sudo adduser kibanarunner and sudo -u kibanarunner ./bin/kibana but that didn't do the trick either.
I want Kibana to stay up-and-running after I stop my SSH session - how can I do this?
You can detach the process from your session.
./bin/kibana &
disown
The answer from Louis-Philippe Huberdeau wasn't working for me, so this is my solution:
sh kibana-4.0.1-linux-x64/bin/kibana >> /var/log/kibana.log(or /dev/null) &
I find running Kibana4 as a service the most convenient practice. It works (near flawlessly) even after you disconnect SSH. One can (re)start/stop it with one simple command. To run Kibana as a service, first download the kibana4 init script:
cd /etc/init.d
sudo wget https://gist.githubusercontent.com/thisismitch/8b15ac909aed214ad04a/raw/bce61d85643c2dcdfbc2728c55a41dab444dca20/kibana4
Enable the Kibana4 service and you're good to go:
sudo chmod +x /etc/init.d/kibana4
sudo update-rc.d kibana4 defaults 96 9
sudo service kibana4 start
Complete credits to this answer goes to this wonderful step-by-step ELK installation guide. You can do likewise for Elasticsearch, Logstash and Logstash-forwarder as well.
You should try using
screen -d -m ./bin/kibana
Or another useful way:
nohup ./bin/kibana > kibana.log 2>&1 &
I recommend this command (ubuntu):
nohup ./kibana/bin/kibana &
so I installed APACHE on linux ..and I typed apachectl start and get httpd (pid 1766) already running but I can't see nothing on the browser .. When I type the local IP address of the machine, It's supposed to bring a screen with APACHE to show that it's running now ..but page keeps loading and loading ..
There're a problem with config.
First try restart (if pid already running... first stop)
Another question help you
Open httpd.conf, looking httpd.pid (or apache.pid or chain. "Pid") for the location
ps aux |grep httpd # you see process of apache running. If running stop it. Check the settings
On system ls -lisa "location_of_pid"
If any result, remove file "location_of_pid"