Script to Find an Unload File

Vernon Young
Vernon Young used Ask the Experts™
I need to write a script that will find all plist files in /Library/LaunchAgents/ that start with connectwisecontrol and contain onlogin in the file names then unload them.

We use ConnectWise Control for providing remote support to our users. The client is installed on the machine and runs at boot. The problem is that we have an application that is used a few times per year that conflicts with ConnectWise Control. Our solution is to close ConnectWise while the other application is running.

Running the following:

launchctl unload /Library/LaunchAgents/connectwisecontrol-xxxxxxxxxxxxxxxxx-onlogin.plist

That closes the ConnectWise Agent running in the background and allows the other application to work fine.

My ideal solution would be to use Automator or create or package a script that runs that command and then kicks off the other application when the user clicks it.

The part that I'm unsure of is how to write a script that finds the plist. The xxxxx's in that file vary depending on the computer. I need to search for that plist and then insert it into the unload statement.

Any guidance would be greatly appreciated!

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
cd  /Library/LaunchAgents/; find . -name "connectwisecontrol-*-onlogin.plist" |xargs launchctl unload
Vernon YoungDirector of Information Technology


That worked perfectly! Thanks so much!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial