Skip to content

Instantly share code, notes, and snippets.

@rmrhz
Created Nov 23, 2018
Embed
What would you like to do?
Any *AMP sucks, so I have my own.
@echo off
:: WEMP Runner
:: rhz <rmrhz@tfwno.gf>
SETLOCAL
:: Server Runner
SET "root=%CD:~0,3%"
SET "dev=dev\"
SET "bin=bin\"
:: Nginx variables
SET "nginxdir=%root%%dev%%bin%nginx\"
SET "nginxcfg=%nginxdir%conf\nginx.conf"
SET "nginxins=nginx.exe"
:: Global PHP variables
SET "phpbpt=127.0.0.1:9000"
SET "phpcgi=php-cgi.exe"
SET "phpcfg=php.ini"
:: Common PHP INI (Extensions should be equally distributed to all versions)
SET "phpdir=%root%%dev%%bin%php\"
:: PHP 7.1.* (7.1.*) variables [NTS~x64]
SET "php71ins=%phpdir%php71\"
SET "php71cfg=%phpdir%php71\"
:menu
cls
c:
echo Server Runner
echo --
echo (1) : Nginx + PHP7.1(NTS) x64
echo --
echo (d) : Restart Acrylic DNS Server
echo (e) : Edit Configuration Files
echo (s) : Stop Server Components
echo --
echo (x) : Exit
set input=nothing
set /p input=Choice:
if %input%==1 goto startNginxPHP71
if %input%==d goto restartAcrylic
if %input%==e goto edit
if %input%==s goto stop
if %input%==x goto exit
goto menu
:startNginxPHP71
cls
d:
echo Starting Nginx
start /B %nginxdir%%nginxins% -c %nginxcfg% -p %nginxdir%
echo Starting PHP 7.1 NTS FastCGI
start /B %php71ins%%phpcgi% -b %phpbpt% -c %php71cfg%%phpcfg%
pause
goto menu
:restartAcrylic
cls
echo Restarting Acrylic DNS Server
echo --
%root%%dev%%bin%acrylic\AcrylicController.exe StartAcrylicServiceSilently
pause
goto menu
:stop
cls
taskkill /f /im nginx.exe
taskkill /f /im php-cgi.exe
pause
goto menu
:edit
cls
@where vim >nul 2>nul
if %ERRORLEVEL% neq 0 goto menu
echo Configuration Files
echo --
echo (a) : Acrylic Hosts File
echo --
echo (x) : Back
set input=nothing
set /p input=Choice:
if %input%==a goto editAcrylicHosts
if %input%==x goto menu
:editAcrylicHosts
cls
vim %root%%dev%%bin%acrylic\AcrylicHosts.txt
goto menu
:exit
cls
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment