(imported comment written by SystemAdmin)
Ken:
Well, from what I hear, you may have already gotten this to work, but for others, I thought I’d post some suggestions, when working on a situation like this (this is what I was going to post), before I heard that your problem was solved:
So, as you know OSX commandline adminisration is a ‘strange beast’; half BSD, half GUI,
etc. and the GUI often ‘hides’ things from you. So, scripting tasks sometimes work
in non-intuitive ways, especially as the Agent runs as root ( so you shouldn’t have
to sudo), but the Agent doesn’t have the same commandline context that you have from
Terminal.app. Some things may work from your commandline, but not in a script, and vice-versa.
Now, another weird thing that I’ve experienced, is that some vendors work very hard to make it
difficult to script their uninstalls
System utilities are notorious for this
.
To test your problem on a simple scale, I downloaded & installed a utility called Remote Desktop Connection
(actually an OSX version of MSTSC, from Windows) on my OSX10.6.7 box, and then used the following
Actionscript in a fixlet, to remove it:
continue if {exists folder “Remote Desktop Connection.app” of folder “/Applications”}
wait sh -c “rm -rf ‘/Applications/Remote Desktop Connection.app’”
[Looking elsewhere in the forum, this appears to be the desired way to remove an OSX application that
doesn’t provide an uninstall-script (this is essentially the same thing that’s done when
you move an application to the Trash icon). Another reason for doing it this way, is that
it bypasses a lot of the controls that the OSX GUI has].
Now, I often change my fixlet ‘success-criteria’ to ‘all lines have run’ or
specifically enter something like I did for the above, which was:
exists folder whose (name of it as lowercase contains “remote desktop”) of folder “/Applications”
.
Another thing to be aware of, on OSX/UNIX, is that it’s difficult to delete a file
or directory that a service is actively using. If this backup utility is
actively running and using these files while you’re trying to remove them,
it may not let you. Additionally, OSX may even ‘lie’ and tell you it’s deleted them when
it actually hasn’t. So if the above doesn’t work, you might try checking to make sure that
the service has actually been stopped, or shutting it down with a prior actionscript line. You might have
success with something like:
/sbin/service iqbackupsvc stop
or
launchctl unload /System/Library/LaunchDaemons/org.iq.backup.xml
Finally, scripted TEM tasks on OSX/UNIX are often easier to write and debug by creating a .sh script that
successfully runs from the commandline and is then substituted into a fixlet. so if I had a script containing
command a
command b
that successfully ran from the command prompt, I might put it in a fixlet as:
appendfile #!/bin/sh
appendfile command a
appendfile command b
move __appendfile runme.sh
wait chmod a+x runme.sh
wait /bin/sh -c “runme.sh 2>&1 /tmp/blahstatus”
(or I could just run it as 'wait runme.sh) But notice that the status passed back from the ‘runme.sh’ line, here, may not indicate the success or failure of “command b”.
It may just indicate that the shell was successfully started and some command was run. The command,
itself, may or may not correctly pass status back to the initiating script (in this case, the actionscript).
That said, it’s often wise to handle status-checking in your script and to output the status code with
something like …2>&1 file.txt. Or, you can then check this returncode by looking in the TEM log on the OSX endpoint
(remember that this is usually /Library/Application Support/BigFix/BES Agent/__BESData/__Global/Logs with the log file named after the current date, suffixed with .log).
So, hopefully, one or some of these suggestions might help the next person.
all best,
jpsthecelt