HP/UX changes after site testing

This commit is contained in:
2025-11-11 06:02:54 -05:00
parent c2ef3e05e3
commit bd7d5da70e
6 changed files with 88 additions and 28 deletions

2
.gitignore vendored
View File

@@ -23,3 +23,5 @@ rubrik.conf
# Other common ignores
*.swp
*.swo
releases/

View File

@@ -5,13 +5,26 @@
# v1.1 - James Pattinson - October 2025
#
# usage: list_mv.ksh
_SCRIPT_="$0"
get_script_dir() {
src="$0"
dir=$(cd -P "$(dirname "$src")" >/dev/null 2>&1 && pwd)
echo "$dir"
script="$1"
case "$script" in
/*) abs_path="$script" ;;
*) abs_path="$PWD/$script" ;;
esac
while [ -L "$abs_path" ]; do
link=$(readlink "$abs_path")
case "$link" in
/*) abs_path="$link" ;;
*) abs_path="$(dirname "$abs_path")/$link" ;;
esac
done
script_dir=$(dirname "$abs_path")
cd "$script_dir" 2>/dev/null && pwd
}
MYDIR=$(get_script_dir)
MYDIR=$(get_script_dir "$_SCRIPT_")
. $MYDIR/rubrik.conf
. $MYDIR/oracle_funcs.ksh
@@ -45,3 +58,4 @@ awk '
' /tmp/rbkresponse.$$
cleanup

View File

@@ -80,10 +80,11 @@ exit_with_error() {
check_http_error() {
# All good responses start with a 2
if [ ${http_response:0:1} != "2" ]; then
first_char=$(echo "$http_response" | cut -c1)
if [ "$first_char" != "2" ]; then
echo FATAL: HTTP error from API call: $http_response. The server responded with:
cat /tmp/rbkresponse.$$ ; echo ; exit_with_error
fi
fi
}
check_pid() {
@@ -217,7 +218,7 @@ get_mv() {
mvId=$(awk '{match($0, /ManagedVolume:::[a-z0-9-]*/); if (RSTART > 0) {id=substr($0, RSTART, RLENGTH); sub(/"$/, "", id); print id}}' /tmp/rbkresponse.$$)
numChannels=$(awk '{match($0, /"numChannels":[ ]*[0-9]+/); if (RSTART > 0) {val=substr($0, RSTART, RLENGTH); sub(/.*:[ ]*/, "", val); print val}}' /tmp/rbkresponse.$$)
if [[ $mvId == "" ]]; then
if [ -z "$mvId" ]; then
echo ERROR: MV with name $mv_name was not found
exit_with_error
fi
@@ -226,7 +227,7 @@ get_mv() {
get_data_mv() {
mv_name=${HOST}_${ORACLE_SID}_data
mv_name=${HOST}_${ORACLE_SID}_Data
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume?name=$mv_name&is_relic=false"
rest_api_get
@@ -234,7 +235,7 @@ get_data_mv() {
mvId=$(awk '{match($0, /ManagedVolume:::[a-z0-9-]*/); if (RSTART > 0) {id=substr($0, RSTART, RLENGTH); sub(/"$/, "", id); print id}}' /tmp/rbkresponse.$$)
numChannels=$(awk '{match($0, /"numChannels":[ ]*[0-9]+/); if (RSTART > 0) {val=substr($0, RSTART, RLENGTH); sub(/.*:[ ]*/, "", val); print val}}' /tmp/rbkresponse.$$)
if [[ $mvId == "" ]]; then
if [ -z "$mvId" ]; then
echo ERROR: MV with name $mv_name was not found
exit_with_error
fi
@@ -245,16 +246,16 @@ get_log_mv() {
# Look for a log volume. If not present, return the data volume
mv_name=${HOST}_${ORACLE_SID}_logs
mv_name=${HOST}_${ORACLE_SID}_Log
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume?name=$mv_name&is_relic=false"
rest_api_get
logMvId=$(awk '{match($0, /ManagedVolume:::[a-z0-9-]*/); if (RSTART > 0) {id=substr($0, RSTART, RLENGTH); sub(/"$/, "", id); print id}}' /tmp/rbkresponse.$$)
if [[ $logMvId == "" ]]; then
if [ -z "$logMvId" ]; then
echo "INFO: Log volume ($mv_name) not found. Logs will be written to DB volume"
logMvPresent=0
mv_name=${HOST}_${ORACLE_SID}_data
mv_name=${HOST}_${ORACLE_SID}_Data
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume?name=$mv_name&is_relic=false"
rest_api_get
@@ -262,7 +263,7 @@ get_log_mv() {
mvId=$(awk '{match($0, /ManagedVolume:::[a-z0-9-]*/); if (RSTART > 0) {id=substr($0, RSTART, RLENGTH); sub(/"$/, "", id); print id}}' /tmp/rbkresponse.$$)
numChannels=$(awk '{match($0, /"numChannels":[ ]*[0-9]+/); if (RSTART > 0) {val=substr($0, RSTART, RLENGTH); sub(/.*:[ ]*/, "", val); print val}}' /tmp/rbkresponse.$$)
if [[ $mvId == "" ]]; then
if [ -z "$mvId" ]; then
echo ERROR: MV with name $mv_name was not found
exit_with_error
fi
@@ -308,3 +309,4 @@ cleanup() {
rm -f /tmp/rbkresponse.$$
rm -f $PIDFILE
}

View File

@@ -6,12 +6,26 @@
#
# usage: rman_db.ksh <ORACLE_SID>
_SCRIPT_="$0"
get_script_dir() {
src="$0"
dir=$(cd -P "$(dirname "$src")" >/dev/null 2>&1 && pwd)
echo "$dir"
script="$1"
case "$script" in
/*) abs_path="$script" ;;
*) abs_path="$PWD/$script" ;;
esac
while [ -L "$abs_path" ]; do
link=$(readlink "$abs_path")
case "$link" in
/*) abs_path="$link" ;;
*) abs_path="$(dirname "$abs_path")/$link" ;;
esac
done
script_dir=$(dirname "$abs_path")
cd "$script_dir" 2>/dev/null && pwd
}
MYDIR=$(get_script_dir)
MYDIR=$(get_script_dir "$_SCRIPT_")
export ORACLE_SID=$1

View File

@@ -6,12 +6,26 @@
#
# usage: rman_logs.ksh <ORACLE_SID>
_SCRIPT_="$0"
get_script_dir() {
src="$0"
dir=$(cd -P "$(dirname "$src")" >/dev/null 2>&1 && pwd)
echo "$dir"
script="$1"
case "$script" in
/*) abs_path="$script" ;;
*) abs_path="$PWD/$script" ;;
esac
while [ -L "$abs_path" ]; do
link=$(readlink "$abs_path")
case "$link" in
/*) abs_path="$link" ;;
*) abs_path="$(dirname "$abs_path")/$link" ;;
esac
done
script_dir=$(dirname "$abs_path")
cd "$script_dir" 2>/dev/null && pwd
}
MYDIR=$(get_script_dir)
MYDIR=$(get_script_dir "$_SCRIPT_")
export ORACLE_SID=$1
#. $HOME/.profile

View File

@@ -10,12 +10,26 @@
# -v Volume to operate on, logs or data
# -o Operation to perform - open or close the MV
_SCRIPT_="$0"
get_script_dir() {
src="$0"
dir=$(cd -P "$(dirname "$src")" >/dev/null 2>&1 && pwd)
echo "$dir"
script="$1"
case "$script" in
/*) abs_path="$script" ;;
*) abs_path="$PWD/$script" ;;
esac
while [ -L "$abs_path" ]; do
link=$(readlink "$abs_path")
case "$link" in
/*) abs_path="$link" ;;
*) abs_path="$(dirname "$abs_path")/$link" ;;
esac
done
script_dir=$(dirname "$abs_path")
cd "$script_dir" 2>/dev/null && pwd
}
MYDIR=$(get_script_dir)
MYDIR=$(get_script_dir "$_SCRIPT_")
. $MYDIR/rubrik.conf
. $MYDIR/oracle_funcs.ksh