Skip to content
Snippets Groups Projects
Commit 38da58b8 authored by Brian Weaver's avatar Brian Weaver
Browse files

add which_sites_use_module.sh

parent 24b74707
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
if [[ -z $1 ]]; then
echo; echo "Usage: $0 'module_name'";
echo; echo;
exit 1;
fi
LOG_FILE=$1-sites-`date +%Y%m%d_%H%M`.txt;
echo "log file: $LOG_FILE"; echo;
SITES=$(terminus org:site:list ohio-state-arts-and-sciences --upstream=b9baf7af-eb2c-4db5-81e6-32d3d9042572 --fields=name --format=string | sort);
parallel --delay 0.1 --tag "terminus remote:drush {}.live pm:list -- --format=table --fields=status,name |grep $1" ::: $SITES | tee $LOG_FILE
ENABLED_COUNT=$(grep -i 'enabled' $LOG_FILE | wc -l);
DISABLED_COUNT=$(grep -i 'disabled' $LOG_FILE | wc -l);
UNINSTALLED_COUNT=$(grep -i 'not installed' $LOG_FILE | wc -l);
# perl -pi -e 's/^[-\w]+\s+enabled\s+\w+\s*\n//;' $LOG_FILE;
# perl -pi -e 's/^[-\w]+\s+disabled\s+\w+\s*\n//;' $LOG_FILE;
# perl -pi -e 's/^[-\w]+\s+not installed\s+\w+\s*\n//;' $LOG_FILE;
echo;
if [ -s $LOG_FILE ]; then
echo; echo "====================================";
cat $LOG_FILE;
echo "====================================";echo;
else
echo "Pruned log file is empty. Deleted."; echo;
# rm $LOG_FILE;
fi
echo "$ENABLED_COUNT - enabled.";
echo "$DISABLED_COUNT - disabled.";
echo "$UNINSTALLED_COUNT - not installed.";
echo;echo;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment