Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Good to know about the main proc. I wasn't aware. And it is indeed set to auto restart. I just hadn't realized the stop alone would trigger that. I had figured I would need to take the additional step.

    2
  • Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    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 😁)

    2
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Yeah. I see this as being a problem. I was curious how it comes into play.

    The popularity of a show really needs to be taken into account.

    3
  • Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Well,RCON has not fared well. Afaik, I've set things up correctly but the client I'm using (mcrcon) keep returning Error 111: Connection refused.

    • This post got me to direct things to the right IP which I could get with docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mcbe-world.
    • docker port mcbe-world shows that the rcon port is open
    • the server.properties files for the mc server has the relevant rcon lines
    3
  • Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    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

    1
  • Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Ooh. I was not aware of the RCON protocol. Looking into now. This may be the exact thing I need. Thanks for the lead.

    4
  • Redirecting a command to a running process?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    docker exec mcbe-world just gives access to the container so commands can be executed. /stop is a specific command for the MC server running in that container. The process is already running and I am trying to figure out how to issue a command to it... and the other comment in this post referencing "rcon" might be a solution...

    1
  • *Note: Still trying to navigate communities here on Lemmy to replace those from Reddit. If there is a better place such a question, I would welcome the suggestion.* I'm running a Synology NAS, which uses some flavor of Linux distribution. From there, among everything else running, I have a [docker container hosting a Minecraft Bedrock Server](https://registry.hub.docker.com/r/marctv/minecraft-bedrock-server/). The MCBE server is great for fun, but not so great for resource usage. To handle this, most folks setup something to schedule the server to restart. Within Synology, there is a task scheduler where I can run a user-defined script to restart the whole container: `docker restart mcbe-world` This works, but it's a dirty reboot though. I worried about corrupting the world (which I do regularly backup). From within the Minecraft server terminal, [the `/stop` command ](https://www.pocketgamer.com/minecraft/minecraft-bedrock-commands/) will gracefully shut it down. I can't update the container with another application, like screen, because each MCBE update means replacing the entire container (and so destroying the changes). **I am looking to somehow redirect a command to the server if possible.** Using `docker exec -it mcbe-world `, I can execute what I want within the container. [The person here said](https://www.reddit.com/r/admincraft/comments/hpcoy3/comment/fxpb7ex/), one can "inject commands by running the command as the appropriate account and redirecting it into the server" and they gave the example `sudo su -s /bin/bash -c "echo say foobar > /run/service@name"` Unfortunately, this isn't so clear and straight forward to me. **Would anyone here be able to articulate this more clearly for me or have an idea as to how I might issue that /stop command from the Synology scheduled script BEFORE restarting the container?** Thanks! **UPDATE**: Solution here: https://beehaw.org/comment/1088961

    18
    15
    Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    it’s a ridiculous loophole. They are literally saying, “I have this thing that’s so valuable, but I ‘accidentally’ threw it away, it’s worthless now, I need to mark this down as a loss.” They are destroying their own products for tax purposes.

    This. ☝

    2
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    If this is accurate, then it would make a hell of a lot more sense. But... it sounds like these "residuals" need to be payed out differently because this sucks for consumers and... honestly... I think for those that poured themselves into making the content in the first place.

    5
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    But imagine Willow to be entirely Disney. I imagine the tax benefit of cutting it is the best answer to my question, but hell... gah

    1
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Please no. Even after ripping all my music, I still have a one foot thick ream of CDs that I wish I could part with but my partner would murder me over.

    1
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    And this is so true. Both the ripping your own content and then the DRM implications of it all. And all so frustrating.

    And here I just want to buy things. And keep them. In my preferred format. Forever. The end.

    1
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    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.

    2
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Hot garbage they spent a whole lot of money on that could still be served without ever showing on the main title screens. They clearly had to have made a determination that the show would cost them more to keep it available, even though it doesn't entirely make sense to me how that all works.

    4
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    This is what I had heard at some point. It's a tax thing. Even though there are no details, it makes more sense to me now. Reduced value == less taxes. Would love to hear the guts if this... but also at the same time pulling out hair. So much blood, sweat, and tears going into producing something only having it then wiped from existence. smh.

    And I hadn't realized that Westworld was axed too. For a show that made such a huge hubbub and then to remove it entirely?! Ugh

    2
  • Please explain how removing access to shows saves money?
  • GlassHalfHopeful GlassHalfHopeful Now 100%

    Not physical media again. Haha. We got rid of all our DVDs to trim down on all the...stuff. No more stuffffff.

    But it's that or someone hosts it, which costs money and circle around again...

    2
  • www.theverge.com

    Would you all explain to me how *removing* content we expect to have access to is a "cost savings" measure? The following is from the [Willow Wikipedia page](https://en.m.wikipedia.org/wiki/Willow_(TV_series)), which led me to the linked URL: > The series was removed from Disney+ on May 26, 2023, amidst a Disney+ and Hulu content removal purge as part of a broader cost cutting initiative under Disney CEO Bob Iger. I've been abroad for a month and earned some time off afterwards. One of my kids reminded me that we never finished Willow, so I said "let's do it now!" The show wasn't perfect for many reasons, but I wanted to finish it for nostalgia's sake and my child legit found it interesting. Lo and behold, the series isn't on Disney+ any more! A quick search later, I see the above referenced quote linking to the article associated with this post... which only made things worse. *The Mysterious Benedict Society* was something my whole family could watch and enjoy without arguments! *Turner and Hooch* was dorky, but something my youngest loved and it was a super safe and easy pick for us bond over. This post isn't about whether the shows are good. And it isn't about how nearly every show I like ends up cancelled. The point is that I paid for access, they were then quietly removed (for various platforms), and I have zero understanding as to how this saves these companies money. Would someone explain? P. S. Yes, I know this is old news. However, this is just how I am. I'm not up to date with anything in the entertainment world. I intentionally wait a few seasons for things because I loath when shows are cancelled after a season. (I'm looking at you, Firefly.) I'm the same way with books, often waiting to read a trilogy after its published because I don't like the wait in between books. (Thanks, Rothfuss). I just don't take cancellation wells, especially when I was on top of everything including summer podcasts and such. (Now anything with the names Abrams, Lindelof, or Cuse makes my skin crawl.) I know. I'm weird and stuff.

    79
    76
    apnews.com

    Am I wrong in feeling _some_ hope in this (at least concering US law and the huge effect the country has on the climate as a whole)? It feels like this is... _actually something_?

    73
    3
    www.nytimes.com

    The extreme heat has devastated corals.This is a truly heartbreaking read: “The coral didn’t even have a chance to bleach, it just died. It just felt like, ‘Oh my God, we’re in the apocalypse.’ What’s happening?” Archive link: [https://web.archive.org/web/20230731225349/https://www.nytimes.com/2023/07/31/climate/coral-reefs-heat-florida-ocean-temperatures.html](https://web.archive.org/web/20230731225349/https://www.nytimes.com/2023/07/31/climate/coral-reefs-heat-florida-ocean-temperatures.html)

    62
    3
    https://www.washingtonpost.com/politics/2023/07/19/trump-carroll-judge-rape/

    > A judge has now clarified that this is basically a legal distinction without a real-world difference. He says that what the jury found Trump did was in fact rape, as commonly understood. > Kaplan also flatly rejected the Trump team’s suggestion that the conduct Trump was found liable for might have been as limited as groping of the breasts. > > The reason? Trump was not accused of that, so the only alleged offense that would have qualified as “sexual abuse” was forced digital penetration. Beyond that, Trump was accused of putting his mouth on Carroll’s mouth and pulling down her tights, which Kaplan noted were not treated as alleged sexual abuse at trial. > > “The jury’s finding of sexual abuse therefore necessarily implies that it found that Mr. Trump forcibly penetrated her vagina,” Kaplan wrote, calling it the “only remaining conclusion.”

    123
    5

    How are you all managing the varmints in your yard? I've lived in a lot of places in my life and it seems I've found quite the mole and vole hotbed also known as my yard. _sighs_ My dog is able to catch them, but not without digging up tunnels, grass, and making a mess. My neighbor inserts "worms" (poison) into the tunnels, but I don't do that because of our dog. I wish I could lay a yellow brick road for them to follow to a happier place, but they don't seem to be the type to understand. I don't actually want to harm any critters and thus the inner turmoil of humankind vs nature. I really don't like this post and I'm the one who wrote it.

    10
    21

    I have been using various filters like "reddit", "threads", and "titan". My goodness, it transforms the Lemmy experience! And the ability to hide posts. Thank you thank you thank you thank you! Throw in Lemmy's community blocking... I'm so glad to be able to create and prune within Connect. 💜🙏

    5
    1
    https://www.accuweather.com/en/space-news/99-of-humans-are-about-to-experience-sunlight-at-the-same-time/1553746

    > At one precise moment this weekend, nearly all of the 8 billion people on Earth will be able to see sunlight in the sky, the counterpart to the "moment of darkness" that unfolds in December.

    12
    4
    www.cnn.com

    >Rosemary Penwarden, [a 64 year old] climate activist in New Zealand, faces more than 10 years in jall for a fake letter canceling an oil conference. >Three years later, after a trial in the Dunedin District Court, Penwarden was found guilty on Wednesday of two charges of creating and using a forged document. > >“It was a surprise,” she said. “I’m reminded of the topsy-turvy world we’re in. It should not be the grandmothers on trial, it should be the oil industry, it should be those people who are making massive profits off the destruction of all of our futures.”

    53
    16
    apnews.com

    > Based on an initial investigation, Prache said, he concluded that "the conditions for the legal use of the weapon were not met.” > > Three persons were in the car when police tried to stop it Tuesday, the prosecutor said. Nahel managed to avoid a traffic stop by running a red light. He was later got stuck in a traffic jam. > > Both officers involved said they drew their guns to prevent him from starting the car again. > > The officer who fired a single shot said he wanted to prevent the car from leaving and because he feared someone may be hit by the car, including himself or his colleague, according to Prache. > > Both officers said they felt “threatened” by seeing the car drive off, he added.

    15
    8
    apnews.com

    > The nation’s health disparities have had a tragic impact: Over the past two decades, the higher mortality rate among Black Americans resulted in 1.6 million excess deaths compared to white Americans. That higher mortality rate resulted in a cumulative loss of more than 80 million years of life due to people dying young and billions of dollars in health care and lost opportunity. > For decades, frustrated birth advocates and medical professionals have tried to sound an alarm about the ways medicine has failed Black women. Historians trace that maltreatment to racist medical practices that Black people endured amid and after slavery. > The disparities between Black and white babies is stark: The infant mortality rate in 2021 for white mothers was 5.8, while the infant mortality rate for Black mothers was 12.1, an increase from 10.9 from the prior year. > > Black babies account for just 29% of births in Alabama, yet nearly 47% of infant deaths. > > A 2020 report by the Alabama Maternal Mortality Review Committee found that more than 55% of 80 pregnancy-related deaths that they reviewed in 2016 and 2017 could have been prevented.

    8
    1
    apnews.com

    > In a split two-to-one ruling, three Court of Appeal judges said Rwanda could not be considered a “safe third country” where migrants could be sent. > >But the judges said that a policy of deporting asylum seekers to another country was not in itself illegal, and the government said it would challenge the ruling at the U.K. Supreme Court. It has until July 6 to lodge an appeal. > Human rights groups say it is immoral and inhumane to send people more than 4,000 miles (6,400 kilometers) to a country they don’t want to live in, and argue that most Channel migrants are desperate people who have no authorized way to come to the U.K. They also cite Rwanda’s poor human rights record, including allegations of torture and killings of government opponents. > > Britain has already paid Rwanda 140 million pounds ($170 k) under the deal, but no one has yet been deported there.

    5
    0
    m.imdb.com

    Binged the first five episodes last weekend and the sixth just now (Prime). It's a crime drama interwoven with comedy. It's definetly vulgar, often tiresomely so, with one of the characters. Tonight though, I saw a very human side of her that was really tender and lovely... despite the vulgarity. 😏 On the other hand, Kate Box plays a detective that simply continues to draw me in further with each episode. I want to watch her work. I can feel the reasons why she is who she is. I can see what drives her. I see her brokenness and also what makes her great. I want to know her. I admire her. Tonight, I could truly empathize with her in ways that I haven't been able to with others folks for a long time. I love good story telling like this. 💜 Anyway, it's been worth the watch and I look forward to finishing it out. What do you all think?

    13
    7
    www.space.com

    One of the primary reasons I love Star Trek so much is because of the continued hope it fills me with as I imagine a better future for humanity. I'm grateful for all those who resist and stand up for justice and equality. For the lives lost. For those fighting each day. While my heart feels so often crushed, I can't help but look forward with hope and longing. Never forget that humanity has done better. We've done great harm, but have also grown in light of that. We will continue to see change so long as we keep fighting for change. Such a good episode to watch this evening. I'm a bundle of emotions. 💜 #HumanRights #Justice #Equality #LGBTQ #Racism #BLM #WomensRights #Migrants #Refugees #Poverty

    17
    0

    Working through my personal todo list today and I see this item.🤦‍♂️ I use speech-to-text constantly and I am amused that it somehow caught this and that I saved it! 😁

    7
    9
    GlassHalfHopeful Now
    23 106

    ⓝⓞ🅞🅝🅔

    GlassHalfHopeful@ beehaw.org

    Let go and let entropy. ,🌌