Skip to content

Commit

Permalink
Add check for omsagent workspace link and remove
Browse files Browse the repository at this point in the history
  • Loading branch information
craddm committed Mar 8, 2024
1 parent 06e9b23 commit e168b05
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Clean up temporary files
rm -rf /root/* /root/.[a-zA-Z_]* /tmp/* /tmp/.[a-zA-Z_]*

# Disconnect omsagent from default workspace if it exists
if [ -d "/opt/microsoft/omsagent/" ]; then
# Disconnecting omsagent from default workspace
echo "Connected workspaces:"
/opt/microsoft/omsagent/bin/omsadmin.sh -l
echo "Disconnecting omsagent from connected workspace:"
/opt/microsoft/omsagent/bin/omsadmin.sh -X
else
echo "omsagent not found, continuing..."
fi

# Deprovision this VM
echo -e "\n$(date -u --iso-8601=seconds): Calling deprovisioner on this VM"
waagent -deprovision+user -force 2>&1
Expand Down

0 comments on commit e168b05

Please sign in to comment.