<commit_before>#!/bin/bash

IRODS_HOME=$1
SVC_ACCT=$2
SERVERTYPE=$3
DATABASE_ROLE=$4
DATABASE=$5

# =-=-=-=-=-=-=-
# stop any running E-iRODS Processes
echo "*** Running Pre-Remove Script ***"
echo "Stopping iRODS :: $IRODS_HOME/irodsctl stop"
cd $IRODS_HOME
sudo -u $SVC_ACCT $IRODS_HOME/irodsctl stop

if [ "$SERVERTYPE" == "icat" ] ; then
  # =-=-=-=-=-=-=-
  # determine if the database already exists
  DB=$(sudo -u $SVC_ACCT psql --list  | grep $DATABASE )
  if [ -n "$DB" ]; then
    echo "Removing Database $DATABASE"
    sudo -u $DATABASE_ROLE dropdb $DATABASE
  fi

  # =-=-=-=-=-=-=-
  # determine if the database role already exists
  ROLE=$(sudo -u $SVC_ACCT psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='$DATABASE_ROLE'")
  if [ $ROLE ]; then
    echo "Removing Database Role $DATABASE_ROLE"
    sudo -u $SVC_ACCT dropuser $DATABASE_ROLE
  fi
fi

# =-=-=-=-=-=-=-
# determine if the service account already exists
USER=$( grep $SVC_ACCT /etc/passwd )
if [ -n "$USER" ]; then 
  echo "Removing Service Account $SVC_ACCT"
  deluser $SVC_ACCT
fi

# =-=-=-=-=-=-=-
# remove runlevel symlinks
rm /etc/init.d/e-irods
rm /etc/rc0.d/K15e-irods
rm /etc/rc2.d/S95e-irods
rm /etc/rc3.d/S95e-irods
rm /etc/rc4.d/S95e-irods<commit_msg>[#701] changed deluser to userdel due to lack of existence on redhat or anywhere else for that matter.<commit_after>#!/bin/bash

IRODS_HOME=$1
SVC_ACCT=$2
SERVERTYPE=$3
DATABASE_ROLE=$4
DATABASE=$5

# =-=-=-=-=-=-=-
# stop any running E-iRODS Processes
echo "*** Running Pre-Remove Script ***"
echo "Stopping iRODS :: $IRODS_HOME/irodsctl stop"
cd $IRODS_HOME
sudo -u $SVC_ACCT $IRODS_HOME/irodsctl stop

if [ "$SERVERTYPE" == "icat" ] ; then
  # =-=-=-=-=-=-=-
  # determine if the database already exists
  DB=$(sudo -u $SVC_ACCT psql --list  | grep $DATABASE )
  if [ -n "$DB" ]; then
    echo "Removing Database $DATABASE"
    sudo -u $DATABASE_ROLE dropdb $DATABASE
  fi

  # =-=-=-=-=-=-=-
  # determine if the database role already exists
  ROLE=$(sudo -u $SVC_ACCT psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='$DATABASE_ROLE'")
  if [ $ROLE ]; then
    echo "Removing Database Role $DATABASE_ROLE"
    sudo -u $SVC_ACCT dropuser $DATABASE_ROLE
  fi
fi

# =-=-=-=-=-=-=-
# determine if the service account already exists
USER=$( grep $SVC_ACCT /etc/passwd )
if [ -n "$USER" ]; then 
  echo "Removing Service Account $SVC_ACCT"
  userdel $SVC_ACCT
fi

# =-=-=-=-=-=-=-
# remove runlevel symlinks
rm /etc/init.d/e-irods
rm /etc/rc0.d/K15e-irods
rm /etc/rc2.d/S95e-irods
rm /etc/rc3.d/S95e-irods
rm /etc/rc4.d/S95e-irods
{'fraction_non_alphanumeric': 0.16943907156673113, 'fraction_numerical': 0.015087040618955513, 'mean_word_length': 3.405451448040886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5593532', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1040, 'n_words': 272}