Skip to content

Instantly share code, notes, and snippets.

@amitkhare
Created April 29, 2020 17:23
Show Gist options
  • Save amitkhare/bbb23cc1a5d2bed07f4f50a97f567912 to your computer and use it in GitHub Desktop.
Save amitkhare/bbb23cc1a5d2bed07f4f50a97f567912 to your computer and use it in GitHub Desktop.
#!/bin/sh
dirbase="/var/www/"
# cd $dirbase
read -p "Current Directory as base?(y/N) " isCurrDir
if [ "$isCurrDir" = "Y" ] || [ "$isCurrDir" = "y" ]; then
dirpath=$(pwd)
else
read -p "Enter project path: $dirbase" ddir
ddir=${ddir:-''}
dirpath=$dirbase$ddir
fi
read -p "Enter Port (default:2082):" pport
pport=${pport:-2082}
if [ ! -e $dirpath ]; then
mkdir $dirpath
elif [ ! -d $dirpath ]; then
echo "$dirpath already exists but is not a directory"
exit
fi
cd $dirpath
echo "Your Project will run on port: $pport"
forever stopall
forever start /c9sdk/server.js -w "$dirpath" -p $pport -l localhost -a USERNAME:PASSWORD
clear
echo "Your C9 project '$dirpath' is running on port $pport."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment