I killed a process (a simple .jar running in the background as a global agent) by pkill -9 java. Since the global agent in launchd is configured as keepAlive the process gets restarted immediately.

Unfortunately this nasty popup ("The action Run Shell Script encountered an error") comes up and prevents the restart of the process without user interaction.enter image description here

Is it possible that launchd simply restarts the process without waiting that the user presses OK in this popup? After pressing OK the process gets restarted properly.

EDIT: The script is as follows enter image description here


If you terminate the java process with kill -9, the shell which called gets an error code back. In your case, the execution of java is the only command in the script run by Automator, so the error code is interpreted by Automator as a general error which triggers the popup.

If you add any other command after the java call (well, any which ends successfully), the Run Shell Script action will complete successfully and Automator will not even notice that the java process was terminated. This command can be something simple like : (which in this form basically does nothing) or sleep 0 (which usually exits successfully).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .