1

So I have a Minecraft server on my spare system. It runs 24/7 but as I plan to get more servers I and other system I want a way for when the UPS goes to battery mode it will trigger a script which if the power stays off long enough . Now I have the shutdown.sh already made and kinda know how the get the script to execute another I just need warn the players on the server. Now my server is java based and runs through the terminal and my issue is that I can't seem to find a way to push commands to the server like -/say server shutting down in 1 minute -

Now I have a program already that can trigger the script I need for when the server shuts down and stuff I just need help pushing and executing the commands on the server terminal.

in short i need a way for a script to execute commands in an active terminal

And before anyone says anything I already have a startup script

Here is the flow of the scripts I'm planning

script 1 general power failure steps

  1. after 30 seconds of power loss

  2. Will say msg on server with a 4 minute timer

  3. after 2:30 minutes will say its doing a preemptive save

  4. if all good till end of time

  5. at the end of 4 minutes the sever software will receive a stop command and 10-30 seconds later a full system shutdown

script 2 power fail and low ups battery

X1. if ups battery starts reaching a certain percent like 30%

X2. will immediately force step 3. along with server msg saying reading low battery early immediate shutdown in progress

X3. well enforce step 5 immediately regardless of how much time is left

0 Answers0