Environment and requirements
The solution runs in Linux based Operating System with:
- /bin/bash
- zip and/or gzip applications
To run in Windows the OS might have:
- Powershell
Script:
Jira
#!/bin/bash
######################
# supportzip.sh
# Author: Douglas Alves - dalves@atlassian.com in behalf of Atlassian Customer Success team
# Atlassian doc:
# https://confluence.atlassian.com/x/BZgBQw
# Versioning:
# 0.1 20220324 - Initial version
# 0.2 20220328 - Password sanitization
# 1.0 20220419 - Added thread dump
# To-do:
# Consult perf data (DB latency, OS, etc)
######################
USER=`whoami`
WHEREAMI=`pwd`
DATE=`date +%Y-%m-%d-%H-%M-%S`
TD=0
########THE OPTIONS#####
usage() {
echo "Usage: $0 [-h <jira home path>] [-a <jira app path>] -t
-h: obligatory, absolute path of jira home directory
-a: obligatory, absolute path of jira application directory
-t: optional, to run and collect thread dumps" 1>&2; exit 1; }
while getopts ":a:h:t" o; do
case $o in
h|H)
h=${OPTARG}
;;
a|A)
a=${OPTARG}
;;
t|T)
TD=1
;;
*)
usage
;;
esac
done
if [ -z $h ] || [ -z $a ]; then
usage
fi
###############THE PATHS
JIRAAPP=$a
JIRAHOME=$h
BEXPORT=$JIRAHOME/export
LOG=$BEXPORT/Jira_support_$DATE.log
EXPORT=$BEXPORT/Jira_support_$DATE
echo '
__ ------------------------------------------
_(\ |@@| | Beep - Generating Atlassian Support Zip |
(__/\__ \--/ __ /_------------------------------------------
\___|----| | __
\ }{ /\ )_ / _\
/\__/\ \__O (__
(--/\--) \__/
_)( )(_
`---''---`
'
echo "
##############################
# Atlassian support zip tool #
##############################
User = $USER
Jira Home = $JIRAHOME
Jira App = $JIRAAPP
Hit CTRL+C (10s wait) if any path or user is incorrect.
"
sleep 10
echo "`date +%Y-%m-%d-%H-%M-%S` - Start creating the Support Zip file" >> $LOG
#Create the basic structure
mkdir -p $EXPORT/{application-properties,healthchecks,tomcat-config,application-config,auth-cfg,thread-dump,tomcat-logs,application-logs,cache-cfg,tomcat-access-logs,cluster-nodes}
#application-logs
echo ' - Packing application logs'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-logs" >> $LOG
cp -rf $JIRAHOME/log/* $EXPORT/application-logs/
# application-config
#Jira configuration files
echo ' - Packing application config files'
echo "`date +%Y-%m-%d-%H-%M-%S` - application-config" >> $LOG
cat $JIRAHOME/dbconfig.xml | sed 's/\<password\>.*/\<password\>Sanitized by Support Utility\<\/password\>/g' | sed 's/\<username\>.*/\<username\>Sanitized by Support Utility\<\/username\>/g' > $EXPORT/application-config/dbconfig.xml
cp -f $JIRAAPP/atlassian-jira/WEB-INF/classes/{
entityengine.xml,log4j.properties} $EXPORT/application-config/
cp -f $JIRAAPP/bin/{
setclasspath.sh,setenv.sh,shutdown.sh,start-jira.sh,startup.sh,stop-jira.sh} $EXPORT/application-config/
for i in setclasspath.sh setenv.sh shutdown.sh start-jira.sh startup.sh stop-jira.sh ; do tmp=`echo $i | sed 's/\./-/g'`; mv $EXPORT/application-config/$i $EXPORT/application-config/$tmp.txt; done
#auth-cfg
#If exists <jira-home>/logs/support (possibly will gather old data) will grab the file however changing name to avoid confusion
echo ' - Packing configuration summary, if any available'
echo "`date +%Y-%m-%d-%H-%M-%S` - auth-cfg" >> $LOG
if [ -f<