SuperKid Posted January 25, 2014 Share Posted January 25, 2014 Hi, I am looking to write simple script so when I run it, if both are running it stops them, if they are not it starts them, this is the script I have so far: #!/bin/bash launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist How can I make it so if they are loaded it unloads them if its not it loads them? like a condition? Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 25, 2014 Veteran Share Posted January 25, 2014 like this so this one check to see if gedit is running #!/bin/bash if ps aux | grep "[g]edit" > /dev/null then echo "Running" else echo "Stopped" fi SuperKid and Shadrack 2 Share Link to comment Share on other sites More sharing options...
Recommended Posts