Start – Stop Apache HTTP server by click

Usually, you start and stop the apache server by the terminal on Mac OS X.

Example

# start Apache
$ sudo apachectl start

# Restart Apache
$ sudo apachectl restart

# Stop Apache
$ sudo apachectl stop

But with the help of Automator, you can do it by simple click.

Steps

Start the Automator and select “Application”.

automator apache

Now insert the action “Run AppleScript” from library into workflow window.

automator apple script

Insert the following script and save your application.

do shell script "
!#/usr/bin/env bash
if ! ps ax | grep httpd | grep -v grep > /dev/null ; then
  sudo apachectl start
else
  sudo apachectl stop
fi
" with administrator privileges

As a small highlight you can change the icon. Select your app and press “CMD” + “i”. Now drag an other icon file on place of Automator icon.

automator icon

Improve your daily workflow

As a test manager I have to check every day, many test results in my browser. With the Automator i can save time.

Steps

Start Automator and select “Application”

os x automator

Select “Internet” on “Library” and double click “Get Specified URLs” to get the action into the workflow window. Now insert all URLs.

automator get specific url
automator get specific url

Add in the “Display Webpages” action and save it.

automator display webpages

Attention: default path is “/Users//Library/Services/”, but you can save it on other locations, too.

automator application