Last active
February 10, 2017 10:00
-
-
Save ftiff/8f4d82ed11f4363fa6589d435b6f3645 to your computer and use it in GitHub Desktop.
mycliapp-launchdaemon.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
plist=/Library/LaunchDaemons/io.fti.mycliapp.plist | |
# Scenario 1 -- app:killed instantaneously -- plist:removed -- launchdaemon:removed | |
/Applications/MyCliApp.app/Contents/MacOS/MyCliApp & | |
rm $plist | |
launchctl remove io.fti.mycliapp | |
# Scenario 2 -- app:launched -- plist:may not be removed (eg. reboot) -- launchdaemon:same | |
/Applications/MyCliApp.app/Contents/MacOS/MyCliApp | |
rm $plist | |
launchctl remove io.fti.mycliapp | |
# Scenario 3 -- app:not_launch (see error below) -- plist:removed -- launchdaemon:removed | |
# Error -> "nohup: can't detach from console: Inappropriate ioctl for device" | |
nohup /Applications/MyCliApp.app/Contents/MacOS/MyCliApp & | |
rm $plist | |
launchctl remove io.fti.mycliapp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment