-
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.
SVCPLAN-4857 new script to run generic SQL on a remote PG server
remote_control replaces jiractl update mk_test_server for confluence rename scripts for confluence update fix_network for confluence server fix_app_config fixed for Confluence add rcp remote-copy clean_xml.sh start/stop services; upgrade_app fix_java_heap_size.sh set_web_access move get_installer to utils add elapsed time in upgrade systemd wants=postgresql move confluence sql to its own cleanup foldeer split cleanup into jira & wiki specific dirs update versions for workflow actions remove COPY cleanup from Dockerfile add workflow env use version main in env deactivate user working quiet grep & puppet resource disable use lvmdevices to deldev HeapDumpOnOutOfMemoryError update for production PM update .gitignore Complete sso_bypass.sh Add option to specify key and additional errors SVCPLAN-4131 migrate to JSM go_log_rotate.sh go_mk_atlassian_supportzip.sh add check for cmdline action in go_upgrade_app attachments tarpipe script migrate attachments working enable service after installing service file update api functions to work with netrc script to enable/disable mail delivery
- Loading branch information
1 parent
8f1dce9
commit cc3fac0
Showing
23 changed files
with
861 additions
and
49 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
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.