Create a automator application able to launch and quit from dock I have a shell command thats runs endlessly, until you stop it using Control-C. When I run it from the Terminal, it goes something like:

$ /abspath/to/my-command
Command is running ...
Use Control-C to stop it.


I wanted to be able to launch this command easily from the dock, so I created an Automator application, with just a Run Shell Script component, where I wrote /abspath/to/my-command. Then, I saved "MyApp.app" in my Applications folder and drag &amp; drop it to the dock.

So far, it works great, when I click the app on the dock, the command starts running. There's just one huge problem: I cannot quit the application! In fact, in the dock it doesn't even appear that the application is running. The only solution I have found so far is to do ps aux | grep my-command and then kill -9 &lt;PID&gt;.

How can I quit "MyApp.app" (like doing Control-C in the Terminal)?
Your app does start the process and then quits itself straight away leaving the process running.

You could try and check in the Automator action to see if the process is running. if it is quit it, if it is not launch it.

 isRunning=`ps aux | grep -i "Textedit.app"| grep -v grep`

    if [ $isRunning -eq "" ]; then 
        echo "is Not Running" 

/abspath/to/my-command
    else
        echo "is Running"  

# terminate code  here
    fi;


So when you click the App in the Dock. to will either start the process or stop it.