-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chown recursively add sudo for chmod on send_migration_file update jira config sample go_log_rotate.sh go_mk_atlassian_supportzip.sh new sql for missing groups update jira config sample updates to upgrade process add check for cmdline action in go_upgrade_app updates for general docker runs
- Loading branch information
1 parent
91b53cb
commit 14337b7
Showing
16 changed files
with
496 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,6 @@ output | |
*.sample | ||
*.csv | ||
*.tsv | ||
|
||
# log files | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/bash | ||
|
||
# See also: https://jira.ncsa.illinois.edu/browse/SVC-24653 | ||
|
||
|
||
### | ||
# Global Variables | ||
### | ||
YES=0 | ||
NO=1 | ||
LOG_DIR=/var/log | ||
ARCHIVE_DIR=/backups/old_logs | ||
MAX_ARCHIVE_AGE=30 #days | ||
DATE=$(date +%Y%m%d_%H%M%S) | ||
VERBOSE=$YES | ||
DEBUG=$NO | ||
#DEBUG=$YES | ||
|
||
|
||
### | ||
# Functions | ||
### | ||
|
||
die() { | ||
echo "ERROR: ${*}" 1>&2 | ||
exit 99 | ||
} | ||
|
||
|
||
force_rotate_logs() { | ||
echo "${FUNCNAME[0]} ..." | ||
local _vopts _dopts | ||
[[ $VERBOSE -eq $YES ]] && { | ||
set -x | ||
_vopts+=( '-v' ) | ||
} | ||
[[ $DEBUG -eq $YES ]] && _dopts+=( '-d' ) | ||
/usr/sbin/logrotate -f ${_vopts[@]} ${_dopts[@]} /etc/logrotate.conf | ||
echo "${FUNCNAME[0]} OK" | ||
} | ||
|
||
|
||
archive_logs() { | ||
echo "${FUNCNAME[0]} ..." | ||
local _vopts | ||
[[ $VERBOSE -eq $YES ]] && { | ||
set -x | ||
_vopts+=( '-v' ) | ||
} | ||
[[ $DEBUG -eq $YES ]] && _dopts+=( '-d' ) | ||
local _tgz="${ARCHIVE_DIR}"/"${DATE}".tgz | ||
local _tmp=$( mktemp -p "${ARCHIVE_DIR}" ) | ||
>"${_tmp}" find "${LOG_DIR}" -type f \ | ||
-name '*.[0-9]' \ | ||
-o -name '*.gz' \ | ||
-o -regextype egrep -regex '.*-[0-9]{8}' | ||
if [[ $DEBUG -eq $YES ]] ; then | ||
echo "DEBUG - files that would have been archived:" | ||
cat "${_tmp}" | ||
elif [[ -s "${_tmp}" ]] ; then | ||
tar -zcf "${_tgz}" ${_vopts[@]} -T "${_tmp}" --remove-files | ||
fi | ||
rm "${_tmp}" | ||
echo "${FUNCNAME[0]} OK" | ||
} | ||
|
||
|
||
clean_old_logs() { | ||
echo "${FUNCNAME[0]} ..." | ||
[[ $VERBOSE -eq $YES ]] && set -x | ||
local _action='-delete' | ||
[[ $DEBUG -eq $YES ]] && _action='-print' | ||
find "${ARCHIVE_DIR}" -type f -mtime +${MAX_ARCHIVE_AGE} $_action | ||
echo "${FUNCNAME[0]} OK" | ||
} | ||
|
||
|
||
### | ||
# MAIN | ||
### | ||
|
||
[[ $VERBOSE -eq $YES ]] && set -x | ||
|
||
force_rotate_logs | ||
|
||
archive_logs | ||
|
||
clean_old_logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/bash | ||
|
||
# See also: https://jira.ncsa.illinois.edu/browse/SVCPLAN-5454 | ||
|
||
|
||
### | ||
# Global Variables | ||
### | ||
YES=0 | ||
NO=1 | ||
CHOME=/srv/confluence/home | ||
CAPP=/srv/confluence/app | ||
DATE=$(date +%Y%m%d_%H%M%S) | ||
SUPPORTZIP=/root/${DATE}.support.zip | ||
CPUZIP=/root/${DATE}.cpu_usage.zip | ||
VERBOSE=$NO | ||
|
||
|
||
### | ||
# Functions | ||
### | ||
|
||
die() { | ||
echo "ERROR: ${*}" 1>&2 | ||
exit 99 | ||
} | ||
|
||
|
||
get_confluence_pid() { | ||
[[ $VERBOSE -eq $YES ]] && set -x | ||
local _pid=$( systemctl show -p MainPID --value confluence ) | ||
local _cmd=$( ps -p $_pid -o comm= ) | ||
local _usr=$( ps -p $_pid -o user= ) | ||
[[ "$_cmd" != "java" ]] && die "Unknown command '$_cmd' for pid '$_pid' ... expected 'java'" | ||
[[ "$_usr" != "confluence" ]] && die "Unknown user '$_usr' for pid '$_pid' ... expected 'confluence'" | ||
echo "$_pid" | ||
} | ||
|
||
|
||
dump_cpu_threads() { | ||
# Get Thread dumps and CPU usage information | ||
[[ $VERBOSE -eq $YES ]] && set -x | ||
echo "Dump CPU Threads (this will take a few minutes) ..." | ||
local _tempdir=$( mktemp -d ) | ||
pushd "$_tempdir" | ||
for i in $(seq 6); do | ||
top -b -H -p $CONF_PID -n 1 > conf_cpu_usage.$(date +%s).txt | ||
kill -3 $CONF_PID | ||
sleep 10 | ||
done | ||
echo "... Dump CPU Threads OK" | ||
|
||
echo "Make CPU Threads zip ..." | ||
zip -q $CPUZIP conf_cpu_usage.*.txt | ||
echo "... Make CPU Threads zip OK" | ||
|
||
popd | ||
rm -rf "$_tempdir" | ||
} | ||
|
||
|
||
mk_support_zip() { | ||
[[ $VERBOSE -eq $YES ]] && set -x | ||
echo "Make support zip (this will also take a minute) ..." | ||
zip -q $SUPPORTZIP \ | ||
${CHOME}/confluence.cfg.xml \ | ||
${CHOME}/logs/* \ | ||
${CAPP}/logs/* \ | ||
${CAPP}/conf/server.xml \ | ||
${CAPP}/bin/setenv.sh | ||
echo "... Make support zip OK" | ||
} | ||
|
||
### | ||
# MAIN | ||
### | ||
|
||
[[ $VERBOSE -eq $YES ]] && set -x | ||
|
||
CONF_PID=$( get_confluence_pid ) | ||
|
||
dump_cpu_threads | ||
|
||
mk_support_zip | ||
|
||
echo | ||
echo "Atlassian support files:" | ||
ls -l /root/${DATE}*.zip | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.