Skip to content

Commit

Permalink
Rename & Cleanup
Browse files Browse the repository at this point in the history
Basic Renaming of files. better documenting
  • Loading branch information
CyberKite committed Mar 24, 2023
1 parent 984602d commit 5195daf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
57 changes: 32 additions & 25 deletions BE_LaunchServer.bat → BE_LaunchServer.cmd
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
@echo off

echo initiating startup sequence. don't kill this. it'll die with the server.
start "Bedrock Dedicated Server" "%~dp0\bedrock_server.exe"

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq bedrock_server.exe"') do set ServerPID=%%b
echo server PID: %ServerPID%

Powershell.exe -executionpolicy remotesigned -File SendWebHook.ps1 -content "Starting (Server)"
echo Server Started

timeout /t 20 >nul

Powershell.exe -executionpolicy remotesigned -File SendWebHook.ps1 -content "Server should be running. Try connecting."
echo Server is running. Hide this Window

:loop
tasklist | find " %ServerPID% " >nul
if not errorlevel 1 (
timeout /t 10 >nul
goto :loop
)

echo Server process died.
Powershell.exe -executionpolicy remotesigned -File SendWebHook.ps1 -content "Server process died."
@echo off

echo initiating startup sequence. don't kill this. it'll die with the server.
start "Bedrock Dedicated Server" "%~dp0\bedrock_server.exe"

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq bedrock_server.exe"') do set ServerPID=%%b
echo server PID: %ServerPID%

::Change up the string in here to modify the Message sent
Powershell.exe -executionpolicy remotesigned -File LogToWebHook.ps1 -content "Starting (Server)"
echo Server Started

::Estimated server startup time

timeout /t 20 >nul

::look above
Powershell.exe -executionpolicy remotesigned -File LogToWebHook.ps1 -content "Server should be running. Try connecting."
echo Server is running. Hide this Window

::Wait until Process PID not found

:loop
tasklist | find " %ServerPID% " >nul
if not errorlevel 1 (
timeout /t 10 >nul
goto :loop
)
echo Server process died.

::You know what by now
Powershell.exe -executionpolicy remotesigned -File LogToWebHook.ps1 -content "Server process died."
Binary file removed Launch Minecraft Server.lnk
Binary file not shown.
2 changes: 1 addition & 1 deletion SendWebHook.ps1 → LogToWebHook.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $hookUrl = "hook"

#$content = read-host -prompt "Enter Message" code from stackoverflow lol
#$content = "predefined"
#i'll use a param
#I'll use a param

$payload = [PSCustomObject]@{content = $content}

Expand Down

0 comments on commit 5195daf

Please sign in to comment.