You were never here, you didn't see anything..

Starting Web Services

I needed a way to start httpd (apache) and mysqld (MySQL) easily and I did not want them running all the time. I use them on my desktop and laptop for web development and testing. Since I don’t work on web stuff all the time it would be senseless to run them all the time. It was just easiest to create a start-stop script to use when I needed it.

You can copy what follows to a file, chmod +x it and run it with start, stop or restart for the desired actions.

# webservices
# Starts or stops services for web hosting, or in this case
# mysqld and httpd (apache ). This script keeps one from
# having to manualy do these things and from having them
# run all the time.
# It calls to the Slackware start up scripts in part to keep
# things clean and simple.

# Start things up:
ws_start() {
	sh /etc/rc.d/rc.mysqld start > /dev/null 2>&1 && echo "mysqld started"
	/usr/sbin/apachectl start > /dev/null 2>&1 && echo "httpd started"

# Stop things:
ws_stop() {
	sh /etc/rc.d/rc.mysqld stop > /dev/null 2>&1  && echo "mysqld stopped"
	/usr/sbin/apachectl stop > /dev/null 2>&1 && echo "httpd stopped"

# Restart them:
ws_restart() {

# Find out what we want to do:
case "$1" in
	  ws_start ;;
	  ws_stop ;;
	  ws_restart ;;
	  echo "usage $0 start|stop|restart"

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *


This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!