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

Open
cameronaaron opened this issue May 6, 2024 · 1 comment
Open

auto restart if the server crashes #648

cameronaaron opened this issue May 6, 2024 · 1 comment

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

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

2 participants