Start apache linux shell script example
![Apache HTTP Server](https://i0.wp.com/www.techpaste.com/wp-content/uploads/2014/07/Apache-HTTP-Server.jpg?fit=245%2C290&ssl=1)
Below is the simple shell script can be used to start and stop apache service.
#!/bin/bash export ctl=/home/programs/httpd-2.0.63/bin/apachectl if test -f $ctl; then case "$1" in start|restart|graceful|stop) $ctl $1 if [ `ps auxwwww|grep httpd|grep -v grep|wc -l` -gt 0 ] then echo Apache is running. else echo Apache is not running. fi ;; status) if [ `ps auxwwww|grep httpd|grep -v grep|wc -l` -gt 0 ] then echo Apache is running. else echo Apache is not running. fi ;; *) echo "Usage: apache start|restart|graceful|stop" esac else echo Apache is not installed; fi
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.