forked from zeljko00/iot-gateway-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshutdown_script.bat
48 lines (34 loc) · 1.54 KB
/
shutdown_script.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
@echo off
setlocal EnableDelayedExpansion
title Windows Shutdown Script
set sensors_mosquitto_window_title=Sensors Mosquitto
set gateway_mosquitto_window_title=Gateway Mosquitto
set can_dispatcher_window_title=CAN Dispatcher
set cloud_window_title=Cloud App
set gateway_window_title=IoT Gateway
set rest_window_title=REST API
set main_console_window_title=Windows Activation Script
taskkill /FI "WINDOWTITLE eq %sensors_mosquitto_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %sensors_mosquitto_window_title% shut down! )
taskkill /FI "WINDOWTITLE eq %gateway_mosquitto_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %gateway_mosquitto_window_title% shut down! )
taskkill /FI "WINDOWTITLE eq %can_dispatcher_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %can_dispatcher_window_title% shut down! )
taskkill /FI "WINDOWTITLE eq %cloud_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %cloud_window_title% shut down! )
taskkill /FI "WINDOWTITLE eq %gateway_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %gateway_window_title% shut down! )
taskkill /FI "WINDOWTITLE eq %rest_window_title%" /F >nul 2>&1
if %errorlevel% equ 0 ( echo %rest_window_title% shut down! )
netstat -ano | findstr 0.0.0.0:3000 > react.txt
set react_process=
for /f "usebackq delims=" %%a in ("react.txt") do (
set "react_process=!react_process!%%a"
)
for /f "tokens=5" %%a in ("!react_process!") do (
set "pid=%%a"
)
set "pid=%pid:~-5%"
taskkill /PID %pid% /F >nul 2>&1
if %errorlevel% equ 0 ( echo React App shut down! )
del react.txt