Posted on 10-17-2012 06:57 PM
I ran up against a wall on this on. If anyone has a better solution I'd love to hear it.
Several of the folks in our company decided to install CrashPlan (Green Version) instead of the CrashPlan Pro (Blue Version) we are licensed for. Part of the issue with removing CrashPlan (Green Version) is that it leaves behind a launchd job that continues to try to launch a missing file. I couldn't unload it using Run Command because it ran after the file was missing and threw an error.
I wrote the following script to assist in the removal and then realized it would probably be a better idea for it to be more generic script. Please feel free to make changes and share it.
#!/bin/sh
# Hardcoded values for the action and file are set here.
action=""
file=""
# Check to see if an action was passed in parameter 4 and if so assign it to the action variable
if [ "$4" != "" ];then
action=$4
fi
# Check to see if a file was passed in parameter 5 and if so assign it to the file variable
if [ "$5" != "" ];then
file=$5
fi
# Verify Action is either "load" or "unload"
if [ "$action" != "load" ] && [ "$action" != "unload" ];then
echo "(un)load was expected; received "$action"."
exit 1
fi
# Verify File exists
if [ ! -f "$file" ];then
echo "$file doesn't exist."
exit 2
fi
# use launchctl to do the action on the file
echo $action"ing "$file"."
launchctl $action $file