Skip to content

Is there a way to manage mac OS login items

edited March 2017 in SecuritySpy
This is not a question about SecuritySpy, but it is related.

Last night our town experienced a power outage. It lasted about an hour.
This morning when I woke up, I noticed that none of my cameras where available, so I logged into my mac where SecuritySpy is installed and I noticed that the mac had successfully relaunched, but on screen was a dialog box saying that it could not connect to my Synology Diskstation.

After clicking the ok button in this dialog box, only then did the mac resume it's launching of login items.
SecuritySpy was apparantly later in the launch list.

The Synology has nothing to do with my SecuritySpy setup, it is only needed for file backups that also run on this mac.

The result is that I don't have footage of the last few hours, which in this case is not a big deal, but when I'm abroad, this might be a problem.
I'd like to be able to tweak this behaviour so that at least all my important apps and services are running without requiring interference from me.

Does anybody have an idea how (and if) the login items can be tweaked so that they are not held back by mac OS dialog boxes that are waiting for confirmation ?

Comments

  • You could potentially make a LaunchAgent for SecuritySpy so it would startup with the user, and not be a "Login Item"
    The LaunchAgent can also be set with keepalive so if SecuritySpy were to happen to crash, it would automatically startup again.

    If you haven't made a LaunchAgent before, it's pretty simple - plain text, XML (really basic XML) the only "tricky" part is the permissions need to be read/write for your user, and read only for groups & everyone. (I can post an example assuming things like SecuritySpy is in the base Applications folder)

    Another option is to make an applescript that specifies startup order of the apps you want to launch - it can even be created to deal with any potential dialog boxes - although that gets pretty advanced.
  • edited March 2017
    Hi Brian, thanks for your reply, you pointed me in the right direction.

    I have been reading up on LaunchAgents and Daemons and found a GUI app called Lingon that does exactly as you describe : https://www.peterborgapps.com/lingon/

    I also found another app called Startupizer : http://gentlebytes.com/startupizer/
    it resembles the second option you describe and it seems to have some cool features.

    I think the LaunchAgents are more robust, but I'm not sure.
    If I go with LaunchAgents, is SecuritySpy guaranteed to launch, even if some system dialog box is waiting for the OK button to be clicked ?

    This is the XML I've come up with, can you check if this looks ok to you ?
    <?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>EnvironmentVariables</key> <dict> <key>PATH</key> <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin</string> </dict> <key>KeepAlive</key> <dict> <key>SuccessfulExit</key> <true/> </dict> <key>Label</key> <string>SecuritySpy</string> <key>ProgramArguments</key> <array> <string>/Applications/SecuritySpy.app/Contents/MacOS/SecuritySpy</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
  • You shouldn't need the Environment Variables in there. Other then that, yes it looks good.

    a Dialog from a "Login Item" shouldn't be able to prevent Security Spy from launching when it starts up from LaunchAgent... but there could be a case where it's possible to happen (dialogs shouldn't be blocking if they follow Apple UI design - except within the one app) - if you do run into a case where it happens, you could move the possible problem app into a delayed start
    (AppleScript method is to "delay 30" or some similar number giving lots of time for everything else to startup, then connect to the Synology in your case, it may even be possible to add extra error checking so it fails silently or checking into the script to detect and dismiss the dialogue if it shows up)
  • Many thanks Brian, that was helpful.
Sign In or Register to comment.