Skip to content

Instantly share code, notes, and snippets.

@foreignfilm
Created April 18, 2013 10:50
Show Gist options
  • Select an option

  • Save foreignfilm/5411853 to your computer and use it in GitHub Desktop.

Select an option

Save foreignfilm/5411853 to your computer and use it in GitHub Desktop.

Revisions

  1. Arnold Sakhnov created this gist Apr 18, 2013.
    15 changes: 15 additions & 0 deletions apache_mac_aliases.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    alias apache-start="sudo apachectl start"
    alias apache-stop="sudo apachectl stop"
    alias apache-restart="sudo apachectl restart"
    alias apache-config="subl /etc/apache2/httpd.conf /etc/apache2/extra/httpd-vhosts.conf /etc/hosts -n"

    apache-toggle-vhost() {
    apache_httpd_conf_file="/etc/apache2/httpd.conf"
    commented_out=$(sudo perl -pi -e 'END { print($prefix)} s/(#?)Include (.*?-vhosts.conf$)/if($1){$prefix=""}else{$prefix="#"}$prefix."Include ".$2/e' $apache_httpd_conf_file)
    if [ -n "$commented_out" ]; then
    terminal-notifier -message "Virtual Hosts are disabled. Apache restarted" -title "Virtual Hosts Off"
    else
    terminal-notifier -message "Virtual Hosts are enabled. Apache restarted" -title "Virtual Hosts On"
    fi
    apache-restart
    }