Create a automator application able to launch and quit from dock
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.