Situation:
An application was patched or update while launched causing it to be damaged and resulting in the spinning beachball during launch or use.
Resolution:
There are a couple of ways that can fix this type of problem. Deciding which method to use would depend upon how wide spread the issue is and the complexity of your environment. Below are two concepts that can be used in resolving this type of problem. The first method covers the use of a shell script to stop the application process, removing it from the agent, followed by deploying and installing a known good version of the application. With the help of a custom inventory rule and a smart machine label, the first resolution will detect other Mac agents exhibiting the same issue and run the shell script only one time to eliminate the conflict.
The second resolution takes the process a step further by using a Plist to also provide preventative maintenance in case the issue returns after it has been resolved. The custom Plist will simply create a placeholder with no stamp inside. The file itself will still carry a standard system stamp. This is similar to what you would do with a custom registry key in a Windows environment.
The example below covers the use of an example shell script, custom inventory rule and smart machine label to resolve this type of problem (using Firefox as an example):
- Navigate to Scripting>choose action>add new item. Choose Online Shell Script as the script type.
- Upload the application used in the managed install as a dependancy.
- Write a script that will kill the application service, uninstall the application and then reinstall the application, followed by tagging a note when the job is complete. Below is a sample shell script for Firefox:
- Save the script. Stay in Scripting. Put your cursor over the newly created script and view the identification number created for it at the bottom left of your web browser.
- Launch the script and edit the shell script by putting the ID number in place of the 'XXX' listed in the above example. Save.
- Navigate to Inventory>Software>Add New Item. Give it a title and create the Custom Inventory Rule to search for the note added to the bottom of the shell script.
- Save.
- Select Home>Label>Smart Labels>Choose Action>Add New item. Select Add New Machine Smart Label.
- Create the Smart Machine Label with the below similar criteria:
NOTE: In place of 'Firefox 12 Replacement Script' use the title of the Software Item name given to the Custom Inventory Rule. - The above Smart Machine Label is basic and further criteria can be added. Once catered to your liking, save it.
- Allow your agents to check in prior to running the script so that the machine label is given ample time to associate to the systems maching the above criteria. Then deploy the script manually or on a schedule.
Below are the steps to create a custom Plist that will be used as a container when resolving this type of issue.
- Navigate to Scripting>Choose Action>Add New Item.
- Select Script Type as Online Shell Script.
- Give the plist script a name. For this example, the name will be "com.kace.kinv.plist".
- Create and deploy the Shell Script with the contents listed in the below picture.
This script will Date/time stamp the .plist. - Save.
The next process is to create a script to uninstall/install the application with the help of the Plist. Stay in Scripting and create a new script. This time, choose Script Type as Online Kscript. Upload the application as the dependancy and use a script similar to the below screenshot using TextWrangler as an example.
To go into the script itself further, below is the breakdown of the script and categories to choose when creating this type of script.
NOTE: The File: field is not required, so leave this blank.
When completed, save the script. Once the Plist and Script have been saved, Create a Machine Smart Label to find machines that do not contain the application. The last step is to create a Custom Inventory Rule to Identify Systems with a plistReturnValue string.
NOTE: The 3142 reference is in reference to the build number of the application used in this example. This is helpful when dealing with an application publisher version that has several build numbers and you are replacing an older build number with a newer of the same version.
Comments