Addigy Profiles provide the means for pushing out lots of vital settings to your devices. By default, Profiles will reinstall themselves every 30 minutes to keep these settings enforced. But, just like Custom Software, you can add a Condition script that will determine when the Profile should be installed.


To read about Custom Software Condition scripts, check out our article Creating Custom Software.


Conditions for Profiles work the same as they do for Custom Software. The Condition script runs before the Profile gets installed. The exit status of the Condition script determines whether the installation will be performed or skipped. This makes Condition scripts for Profiles a very flexible tool for regulating which devices install which Profiles.

 

Adding a Condition

To add a Condition script, select the Condition section of the Profile at the top-left of the Edit window.



By default, Install on Success will be turned on and the Condition script will simply be "true". This will mean that the Profile will install every time it is run. When a Profile with this default Condition is added to a Policy, it will reinstall every 30 minutes when the Policy is run by the device.


Checking if the Profile Is Already Installed

The most common Condition script checks to see if the Profile already exists on the device. This will prevent the Profile from being reinstalled every 30 minutes. Here is a sample Condition script that will check for whatever name is placed in the profileName variable:


profileName="My Example Profile"

if profiles -P | grep "com.addigy.policy.${profileName}"; then
     echo "Profile found. Skipping install."
    exit 1
else
    echo "Profile not installed. Installing."
    exit 0
fi


Note: the Install on Success option should be toggled on for this to function correctly.


In this example, the profileName variable should match exactly what the Profile is titled within Addigy web app.