In the command line type service apache2 status then hit enter. The result should say:
Answer from ebolton on Stack OverflowApache2 is running (pid xxxx)
In the command line type service apache2 status then hit enter. The result should say:
Apache2 is running (pid xxxx)
You can also type "top" and look at the list of running processes.
Why is my Apache server not starting?
What’s the difference between Apache and Nginx?
How often should I monitor my Apache server?
This is a working sample of bash script which check the apache status, restart it automatically if down, and alert by telegram bot within unicode emoji.
#!/bin/bash
telegram=(xxxxx, yyyyyy)
if ! pidof apache2 > /dev/null
then
# web server down, restart the server
echo "Server down"
/etc/init.d/apache2 restart > /dev/null
sleep 10
#checking if apache restarted or not
if pidof apache2 > /dev/null
then
for i in "${telegram[@]}"
do
curl -s -X POST https://api.telegram.org/botxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyy/sendMessage -d chat_id="$i" -d text="`echo -e '\U0001F525'` Apache stoped on Molib Stage. Automatically restarted succesfully."
done
else
for i in "${telegram[@]}"
do
curl -s -X POST https://api.telegram.org/botxxxxxx:yyyyyyyyyyyyyyyyyyyyyyyyyy/sendMessage -d chat_id="$i" -d text="`echo -e '\U0001F525'` Apache stoped on Molib Stage. Automatically restart failed. Please check manually."
done
fi
fi
Use this:
service apache2 status
Or this:
service --status-all | grep apache2
So I just installed apache2 on my server and now I'm looking to test it out and see if I can get a good curl response from it.
I haven't done anything in the var/www/html/index.html, so I presume this is the webpage I want to get a response from.
Running sudo systemctl status apache2.service is telling me apache is running ok, im just not sure how to verify that with getting a valid response from the HTML file. Any ideas??