#!/bin/sh OMI_HOME=/opt/omi OMI_REGISTER_DIR=/etc/opt/omi/conf/omiregister CONFIG_SYSCONFDIR=/etc/opt/omi/conf CONFIG_DATADIR=$OMI_HOME/share OMI_LIB=$OMI_HOME/lib # if this is a package removal, not an upgrade, remove the modules if [ "$1" = "0" -o "$1" = "remove" -o "$1" = "purge" ]; then rm -rf $CONFIG_SYSCONFDIR/omsconfig/configuration rm -rf $CONFIG_DATADIR/omsconfig/ rm -rf $OMI_LIB/Scripts rm -rf /opt/microsoft/omsconfig/ rm -rf $OMI_REGISTER_DIR/root-oms rm -f $OMI_HOME/bin/OMSConsistencyInvoker rm -f $OMI_LIB/libomsconfig.so fi # Remove old output files from calling dsc_host rm -f /opt/dsc/output/* # Note that omsagent's service_control uses systemctl to kill agent (omsagent # still doesn't shut down in a controlled fashion). Two rapid 'kill -9' # operations can confuse systemctl, such that the second 'kill -9' operation # is not completed. This will happen during removal of the shell bundle. End # result is that the omsagent binary is kept running after the second kill # operation. # # Add a 'sleep' operation (ugly, I know) to try and avoid this race condition. /opt/microsoft/omsagent/bin/service_control reload if pidof systemd 1> /dev/null 2> /dev/null; then echo "Pausing briefly for systemctl synchronization ..." sleep 5 fi # Remove seure_update cache rm -rf /var/opt/microsoft/omsconfig_secure_cache exit 0