Last active
August 29, 2015 14:01
-
-
Save josecoelho/39dc1a34b27d720b1df4 to your computer and use it in GitHub Desktop.
BASH Script: Add host to /etc/hosts, exec PHP dev server, Remove host from /etc/hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/sh | |
SITE_DOMAIN="test.production.url"; | |
HOSTS_LINE="127.0.0.1 $SITE_DOMAIN"; | |
COMMENTED_HOSTS_LINE="# $HOSTS_LINE" | |
echo "Add $SITE_DOMAIN to your /etc/hosts"; | |
sudo -- sh -c "echo '$HOSTS_LINE' >> /etc/hosts"; | |
echo "Starting server"; | |
sudo php -S $SITE_DOMAIN:80; | |
echo "Remove $SITE_DOMAIN to your /etc/hosts"; | |
sudo vim -c ":g/$HOSTS_LINE/d|:wq" /etc/hosts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having problems with the integration of pow.cx (ruby) and Apache.
Then for my PHP projects now I'm using the command line server from php and loving it.
This my script for start/end development server.
(works nicely on MAC OS X, and should work on Linux too...)