The Addigy policier is the software utility that downloads, installs, and tracks the progress of all the items applied to a policy. In this article, we'll be referencing some more advanced scripting methods. For more information on running scripts within Addigy, check out our articles on Using the GoLive Terminal and Creating and Running Scripts. These commands were designed to work great when copy-pasted both in the GoLive -> Terminal and are included in the Policy category of Predefined Commands on the Devices page.      


Often, the policier will work well on its own and accurately report all the details of your devices. If the policier should run into any issues, or you would like more information as to if and when it is running here are some advanced commands to run that will give you feedback and control over the policier.      


Check if the Policier is Running on a Device

To check if the policier is currently running, try this command:  


if ! sudo ps aux | grep -v grep | grep policier; then echo "Policier not running." && exit 1; fi


This command will check the running process for the Addigy policier, and return either the processes current information "Policier not running" if the process is not found.     


Start the Policier on Specific Device

To start the policier and run through the device's policy items, try this command:


if sudo launchctl start com.addigy.policier; then echo "Policy started." && exit 0; else echo "Error starting policy." && exit 1; fi


This will kick-off the policier process that downloads and executes all of the items associated with a policy. It will output "Policy started" once the policier kicks off, or "Error starting policy." if it fails to start the policier.      


Note: if the policier is already running, the above command will do nothing.


Check for In-Progress Downloads

To check if a specific file is being downloaded by the device, try this command:


if sudo ps aux | grep -v grep | grep lan-cache; then echo "Download in progress." && exit 0; else echo "No download is being performed." && exit 1; fi



Reset Policy Progress for a Specific Device

Sometimes the device will stop reporting the status of items in the policy. The status of policy items is stored in /Library/Addigy/ansible/status.json . By deleting the status.json file, you can reset the progress information for the device. Try this command to delete the status.json file:


if sudo rm /Library/Addigy/ansible/status.json; then echo "Reset policy progress." && exit 0; else echo "Failed to reset policy progress by deleting status.json file." && exit 1; fi