ⓝⓞ🅞🅝🅔

Let go and let entropy. ,🌌

  • 19 Posts
  • 83 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle

  • YEEEESSS!!! THIS!!! Thank you! I’ve been able to hobble together a script now that I have a Synology automated task calling early each morning after world backups are complete. I’m so very grateful to you all. I’ve learned a lot. A proper “stop” is being issues now which reduces the chance of world corruption which would make my family very very grumpy.

    Here’s the script just in case someone finds themselves in a similar situation as me. This is not my wheelhouse and it’s not pretty. I know it can be better, but I’ve spent too much time on this as it is and need to go fix a washing machine now. Ugh…


    #!/bin/bash
    
    # Define the countdown duration in seconds
    countdown_duration=20
    
    # Function to send a message to the Docker container
    send_cmd() {
      cmd="$1"
      sudo sh -c "echo '$cmd' | socat EXEC:'docker attach mcbe-world',pty STDIN"
    }
    
    # Announce
    announce_text="Daily server restart commencing in $countdown_duration seconds..."
    send_cmd "say $announce_text"
    
    # Perform the countdown
    for ((i = $countdown_duration; i >= 1; i--)); do
      #echo "Restaring in $i seconds"
      countdown_text="Restarting in $i seconds"
      send_cmd "say $countdown_text"
      sleep 1
    done
    
    # Gracefully shutdown server
    #  Note: stopping forces the mcbe container to restart on it's own. 
    #  Not sure why that's the case, but it's the end result I want...
    send_cmd "stop"
    

    P.S. I really need to figure out how to get the RCON solution working because that would be a more elegant way to handle things.

    P.P.S Example run (yes, the timing and spelling were updated after this screenshot 😁)





  • This looked so promising.

    Via SSH, I can indeed use docker attach and from within I can issue a stop for MC server. Works fine.

    However, the Synology task scheduler via DSM doesn’t seem to be able to similarly attach and then issue the stop command. I get this back via email (for when a scheduled task fails):

    Task Scheduler has completed a scheduled task.

    Task: MC Graceful Restart Start time: Tue, 29 Aug 2023 17:19:41 -0500 Stop time: Tue, 29 Aug 2023 17:19:42 -0500 Current status: 127 (Interrupted) Standard output/error:

    the input device is not a TTY /bin/bash: line 1: stop: command not found











  • Yes, this is what I was thinking was the matter. And someone else in this thread posted at a guardian link saying something to the same effect. It’s still mind-boggling to me that to save money the answer is to remove everything completely. It feels like these big production companies are failing people and their use of the tax system is furthering that so they can save money. It just seems strange that they have to axe a show from existence to be able to prove it as a loss to the government.