-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.bat
78 lines (59 loc) · 2.64 KB
/
runner.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@echo off
SET mypid=
if [%1]==[start] call :start >nul 2>&1
if [%1]==[stop] call :stop >nul 2>&1
if [%1]==[status] goto :status
goto :finish
:start
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:9000') do SET mypid=%%~nxa
if not [%mypid%]==[] goto :status
SET mypath=%~dp0
start "portfolio-root" /B /D "%mypath%root-html" npm start >nul 2>&1
start "portfolio-style" /B /D "%mypath%styleguide" npm start >nul 2>&1
start "portfolio-api" /B /D "%mypath%api" npm start >nul 2>&1
start "portfolio-nav" /B /D "%mypath%nav" npm start >nul 2>&1
start "portfolio-home" /B /D "%mypath%home" npm start >nul 2>&1
start "portfolio-showcase" /B /D "%mypath%showcase" npm start >nul 2>&1
goto :finish
:stop
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:9000') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:4100') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:4200') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4201') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4202') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4203') do SET mypid=%%~nxa
if not [%mypid%]==[] taskkill /F /PID %mypid%
goto :finish
:status
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:9000') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Root html running on PID %mypid%) else (echo Root html not running)
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:4100') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Styleguide running on PID %mypid%) else (echo Styleguide not running)
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 0.0.0.0:4200') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Api running on PID %mypid%) else (echo Api not running)
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4201') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Nav running on PID %mypid%) else (echo Nav not running)
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4202') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Home running on PID %mypid%) else (echo Home not running)
SET mypid=
for /f "tokens=5" %%a in ('netstat -aon ^| findstr 4203') do SET mypid=%%~nxa
if not [%mypid%]==[] (echo Showcase running on PID %mypid%) else (echo Showcase not running)
goto :finish
:finish
exit /B