Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto restart if the server crashes #648

Closed
cameronaaron opened this issue May 6, 2024 · 5 comments
Closed

auto restart if the server crashes #648

cameronaaron opened this issue May 6, 2024 · 5 comments

Comments

@cameronaaron
Copy link

It would be nice if the install created a launch agent that could allow it to restart it when if it crashes

@Scr0nch
Copy link

Scr0nch commented May 17, 2024

Here is what I did to achieve this:

  1. Copy the following file contents to ~/Library/LaunchAgents/app.bluebubbles.plist:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>app.bluebubbles</string>
            <key>Program</key>
            <string>/Applications/BlueBubbles.app/Contents/MacOS/BlueBubbles</string>
            <key>RunAtLoad</key>
            <true/>
            <key>KeepAlive</key>
            <true/>
        </dict>
    </plist>

    Note that RunAtLoad will start this launch agent when loaded (which is determined below) and KeepAlive, since it is set to true, will indiscriminately restart BlueBubbles when it exits. As I was researching this, I found that not specifying that the agent should not be restarted when it exits successfully may cause problems with software updates (source), but I haven't had the chance to test this yet.

  2. Disable the built-in autostart:
    Screenshot 2024-05-17 at 12 43 40 PM

  3. Install the launch agent and load it after the current user graphically logs in:

    launchctl bootstrap gui/$(id -u $(whoami)) ~/Library/LaunchAgents/app.bluebubbles.plist
  4. Immediately start the launch agent (only necessary for the first time):

    launchctl kickstart gui/$(id -u $(whoami))/app.bluebubbles

Some additional notes:

  • To uninstall the launch agent:
    launchctl remove app.bluebubbles
  • To print information about the launch agent:
    launchctl print gui/$(id -u $(whoami))/app.bluebubbles

@zlshames
Copy link
Member

Thanks @Scr0nch I've turned this into an official guide! https://docs.bluebubbles.app/server/basic-guides/autostart-server-after-crash

@cameronaaron
Copy link
Author

I have no clue why this has never worked for me in practice it would still be very nice if this was bundled into the bluebubbles application

@zlshames
Copy link
Member

I have no clue why this has never worked for me in practice it would still be very nice if this was bundled into the bluebubbles application

I might be able to have the server do it, but it may require admin privileges. I'll have to see.

It probably didn't work for you because the path that he included as the program variable is in the system applications folder. Whole yours is likely in your User applications folder.

@zlshames
Copy link
Member

Ok i was able to add it as a feature on the server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants