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
after 30 seconds of power loss
Will say msg on server with a 4 minute timer
after 2:30 minutes will say its doing a preemptive save
if all good till end of time
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
man kill
)? – waltinator Jun 30 '20 at 02:10tmux
session and keep it open (attached) in the active terminal where you run your commands... Also you will be able to send commands to this session via scripts and other terminals. Here is how to begin: https://askubuntu.com/a/1027879/566421 – pa4080 Jun 30 '20 at 07:10