Skip to main content
Druva Documentation

Bash script to uninstall Phoenix agents and remove all directories on Linux

 

This article applies to:

  • OS: RHEL, CentOS or SLES hosts and the others for Ubuntu hosts
  • Product edition: Phoenix

Overview

This article provides the single script to uninstall Phoenix agents from a Linux system and remove all its directories from their hosts. 

Uninstall Phoenix agents from a Linux host

  1. Use vi or any text editor to create the bash file.

    # vi /root/Phoenix_uninstall.bash
    # chmod 750 /root/Phoenix_uninstall.bash

     

  2. Add the uninstall script to the bash file.
    • Bash script for RHEL, SLES, and CentOS:

      #!/bin/bash

      #

      # This is a Phoenix/InSync uninstallation script!

      # Please consult Druva Tech Support before use it.

      #

      #

      echo This is a Phoenix/InSync uninstallation script!

      echo Please consult Druva Tech Support before use it.

      echo "Do you wish to proceed (Y/N) ?"

      read ANS

      echo "your answer is $ANS"

      if [ $ANS == N ]

          then

              echo Quit running script…

          exit

          else

              echo Proceed with uninstallations

      fi

      # If the script is to be used by a non-interactive program

      # Lines above this can be commented out with #

      for RPM in $(rpm -qa |grep -i druva)

              do

              echo found Druva packages: $RPM

              echo

              echo uninstalling $RPM

              echo

              rpm -e $RPM

      done

      # To remove all Phoenix directories and files.

      sleep 3

      rm -rf /etc/Phoenix/

      rm -rf /opt/Druva/

      rm -rf /var/log/Phoenix/

      rm -rf /var/Phoenix/

      rm -f /etc/rc.d/init.d/Phoenix

      rm -f /etc/rc.d/rc?.d/?80Phoenix

      rm -f /usr/bin/Phoenix*

      echo Uninstallation Completed.

    • Bash script for Ubuntu:
       

      #!/bin/bash

      #

      # This is a Phoenix uninstallation script for Ubunto.

      # Please consult Druva Tech Support before use it.

      #

      #

      echo This is a Phoenix uninstallation script!

      echo Please consult Druva Tech Support before use it.

      echo "Do you wish to proceed (Y/N) ?"

      read ANS

      echo "your answer is $ANS"

      if [ $ANS == N ]

          then

              echo Quit running script…

          exit

          else

              echo Proceed with uninstallations

      fi

      # If the script is to be used by a non-interactive program

      # Lines above this can be commented out with #

      echo This script will uninstall Druva Phoenix and remove all Phoenix directories from this host!! 

      for PKG in $(dpkg -la |grep -i druva) 

      do 

      echo found Druva packages: $PKG 

      echo 

      echo uninstalling $PKG 

      echo 

      dpkg -r $PKG 

      dpkg --purge $PKG 

      done 

      # To remove all Phoenix directories and files.

      sleep 3 

      rm -rf /etc/Phoenix/ 

      rm -rf /opt/Druva/ 

      rm -rf /var/log/Phoenix/ 

      rm -rf /var/Phoenix/ 

      rm -f /etc/init.d/Phoenix 

      rm -f /etc/rc?.d/*Phoenix 

      rm -f /usr/bin/Phoenix* 

      echo Uninstallation Completed.
       

  3. Check the status of Phoenix package on the host.

    # service Phoenix status

    For example, the Phoenix status may appear as below:

    PhoenixStatusOnLinux.png
  4. Run the bash file to uninstall Phoenix Agents and remove its directories.

    # ./Phoenix_uninstall.bash