Compare commits
7 Commits
67050cf3a0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 04d946aa00 | |||
| bd7d5da70e | |||
| c2ef3e05e3 | |||
| 14b1d29384 | |||
| 024d06a827 | |||
| 09fd3b2c67 | |||
| 6c1f8c926e |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -6,6 +6,7 @@ __pycache__/
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
SCRATCH
|
||||
|
||||
# macOS system files
|
||||
.DS_Store
|
||||
@@ -16,7 +17,11 @@ ENV/
|
||||
|
||||
# Exclude Rubrik API config files
|
||||
rbk_api.conf
|
||||
rubrik.conf
|
||||
*.json
|
||||
|
||||
# Other common ignores
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
releases/
|
||||
|
||||
172
README.md
Normal file
172
README.md
Normal file
@@ -0,0 +1,172 @@
|
||||
# Rubrik Oracle Backup Scripts for HP-UX
|
||||
|
||||
This collection of Korn shell (ksh) scripts provides automated backup solutions for Oracle databases using Rubrik Managed Volumes (MVs) on HP-UX systems. The scripts are designed to be HP-UX compatible and handle RMAN backups with incremental merge functionality.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Operating System**: HP-UX 11i or later (also works on Linux/Solaris/AIX)
|
||||
- **Shell**: Korn shell (ksh) - standard on HP-UX
|
||||
- **Tools**: curl, awk, egrep, date, expr, mkdir, hostname, ps, find, chmod
|
||||
- **Oracle**: Oracle Database with RMAN configured
|
||||
- **Rubrik**: Access to Rubrik CDM with Managed Volumes configured
|
||||
- **Permissions**: Scripts should be run as the Oracle user
|
||||
|
||||
## RMAN Configuration
|
||||
|
||||
The script will
|
||||
|
||||
## Configuration
|
||||
|
||||
1. Copy `rbk_api.conf.example` to `rbk_api.conf`
|
||||
2. Edit `rbk_api.conf` with your Rubrik settings:
|
||||
|
||||
```bash
|
||||
# Rubrik API Configuration
|
||||
ID="your-service-account-id"
|
||||
SECRET="your-service-account-secret"
|
||||
RUBRIK_IP="your-rubrik-cluster-ip"
|
||||
|
||||
# Mount point prefix for Managed Volumes
|
||||
MOUNTPOINT_PREFIX="/rubrik_"
|
||||
|
||||
# Log retention settings
|
||||
HOSTLOGRET=2
|
||||
MV_SPACE_WARN=75
|
||||
|
||||
# Number of RMAN channels to allocate per NFS mount
|
||||
RMAN_CHANNELS_PER_MOUNT=1
|
||||
|
||||
# Logging directories
|
||||
API_LOG_DIR=/tmp/rubrik
|
||||
RMAN_LOG_DIR=/tmp/rubrik/rman
|
||||
|
||||
# Alert settings
|
||||
ALERT_EMAILS="admin@example.com"
|
||||
EMAIL_SUCCESS=1
|
||||
```
|
||||
|
||||
## Scripts Overview
|
||||
|
||||
### oracle_funcs.ksh
|
||||
Shared functions library containing:
|
||||
- API authentication and REST calls
|
||||
- Managed Volume operations (open/close)
|
||||
- Error handling and logging
|
||||
- OS detection and date handling
|
||||
|
||||
### list_mv.ksh
|
||||
Lists all Managed Volumes visible to the configured service account, showing each MV's name and `isWritable` status.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
./list_mv.ksh
|
||||
```
|
||||
|
||||
**Output:**
|
||||
```
|
||||
Service account in use is client|...
|
||||
Managed Volumes visible to this account:
|
||||
mv_name_1: isWritable=true
|
||||
mv_name_2: isWritable=false
|
||||
```
|
||||
|
||||
### rubrik_mv_op.ksh
|
||||
Opens or closes a Managed Volume for backup operations.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
./rubrik_mv_op.ksh -d <DBNAME> -v <logs|data> -o <open|close>
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
```bash
|
||||
# Open data volume for ORCL database
|
||||
./rubrik_mv_op.ksh -d ORCL -v data -o open
|
||||
|
||||
# Close logs volume for ORCL database
|
||||
./rubrik_mv_op.ksh -d ORCL -v logs -o close
|
||||
```
|
||||
|
||||
### rman_db.ksh
|
||||
Performs RMAN database backup with incremental merge to Rubrik Managed Volume.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
./rman_db.ksh <ORACLE_SID>
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- Incremental level 1 backup with merge
|
||||
- Automatic MV open/close
|
||||
- Configurable RMAN channels per NFS mount (RMAN_CHANNELS_PER_MOUNT)
|
||||
- Disk space monitoring
|
||||
- Email alerts on failure/success
|
||||
- Archive log backup
|
||||
|
||||
### rman_logs.ksh
|
||||
Performs RMAN archive log backup to Rubrik Managed Volume.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
./rman_logs.ksh <ORACLE_SID>
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- Backs up all not-backed-up archive logs
|
||||
- Configurable RMAN channels per NFS mount (RMAN_CHANNELS_PER_MOUNT)
|
||||
- Automatic MV open/close
|
||||
- Disk space monitoring
|
||||
- Optional host-side log purging
|
||||
- Email alerts
|
||||
|
||||
## HP-UX Compatibility Notes
|
||||
|
||||
These scripts are specifically designed for HP-UX compatibility:
|
||||
|
||||
- Uses `ksh` instead of `bash`
|
||||
- Avoids GNU-specific commands (`grep -o`, `readlink`)
|
||||
- Portable `awk` for JSON parsing
|
||||
- HP-UX date handling with fallback to GNU date
|
||||
- No reliance on symlinks for script location detection
|
||||
|
||||
## Logging
|
||||
|
||||
- API calls are logged to `$API_LOG_DIR/api_calls.log`
|
||||
- RMAN operations are logged to `$RMAN_LOG_DIR/$ORACLE_SID/`
|
||||
- Use `tail -f` on log files for monitoring
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **"readlink not found"**: Scripts use portable directory detection
|
||||
2. **JSON parsing errors**: Ensure Rubrik API returns expected format
|
||||
3. **MV not found**: Check MV naming convention: `${HOST}_${ORACLE_SID}_data/logs`
|
||||
4. **Permission denied**: Run as Oracle user, ensure MV mount points are accessible
|
||||
5. **Curl errors**: Check network connectivity to Rubrik cluster
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Add debug output by modifying scripts to show raw API responses.
|
||||
|
||||
### Testing Compatibility
|
||||
|
||||
Run the included `test.ksh` script to verify HP-UX compatibility of required tools.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Store `rbk_api.conf` securely with appropriate permissions
|
||||
- Service account should have minimal required permissions
|
||||
- Avoid logging secrets in log files
|
||||
|
||||
## Support
|
||||
|
||||
For issues specific to Rubrik CDM or Oracle integration, consult:
|
||||
- Rubrik documentation
|
||||
- Oracle RMAN documentation
|
||||
- HP-UX system administration guides
|
||||
|
||||
## Version History
|
||||
|
||||
- v1.1: Enhanced list_mv.ksh with isWritable status, HP-UX compatibility improvements
|
||||
- v1.0: Initial release with basic RMAN backup functionality
|
||||
82
check_date.ksh
Executable file
82
check_date.ksh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/ksh
|
||||
echo "Checking date command availability and date arithmetic support..."
|
||||
|
||||
# Check for date commands
|
||||
echo "Available date commands:"
|
||||
if command -v date >/dev/null 2>&1; then
|
||||
echo " date: $(which date)"
|
||||
DATE_CMD="date"
|
||||
else
|
||||
echo " date: NOT FOUND"
|
||||
fi
|
||||
|
||||
if command -v gdate >/dev/null 2>&1; then
|
||||
echo " gdate: $(which gdate)"
|
||||
if [ -z "$DATE_CMD" ]; then
|
||||
DATE_CMD="gdate"
|
||||
fi
|
||||
else
|
||||
echo " gdate: NOT FOUND in PATH"
|
||||
# Check common HP-UX locations for gdate
|
||||
echo " Checking common HP-UX locations for gdate..."
|
||||
for gdate_path in /usr/local/bin/gdate /opt/gnu/bin/gdate /usr/contrib/bin/gdate /opt/coreutils/bin/gdate; do
|
||||
if [ -x "$gdate_path" ]; then
|
||||
echo " gdate: FOUND at $gdate_path"
|
||||
if [ -z "$DATE_CMD" ]; then
|
||||
DATE_CMD="$gdate_path"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$DATE_CMD" ] || [ "$DATE_CMD" = "date" ]; then
|
||||
echo " gdate: NOT FOUND in common locations"
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v perl >/dev/null 2>&1; then
|
||||
echo " perl: $(which perl)"
|
||||
PERL_AVAILABLE=1
|
||||
else
|
||||
echo " perl: NOT FOUND"
|
||||
PERL_AVAILABLE=0
|
||||
fi
|
||||
|
||||
if [ -z "$DATE_CMD" ]; then
|
||||
echo "ERROR: No date command found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Testing date arithmetic with: $DATE_CMD"
|
||||
|
||||
# Test basic date
|
||||
echo "Basic date output:"
|
||||
$DATE_CMD +"%Y-%m-%d %H:%M:%S"
|
||||
|
||||
# Test date arithmetic like used in rman_db.ksh
|
||||
echo ""
|
||||
echo "Testing date arithmetic: '$DATE_CMD +%m-%d-%Y\ %H:%M:%S -d \"-1 hour\"'"
|
||||
if $DATE_CMD -d "-1 hour" >/dev/null 2>&1; then
|
||||
RESULT=$($DATE_CMD +%m-%d-%Y\ %H:%M:%S -d '-1 hour')
|
||||
echo "SUCCESS: Date arithmetic works"
|
||||
echo "Result: $RESULT"
|
||||
else
|
||||
echo "ERROR: Date arithmetic (-d option) not supported"
|
||||
echo "This system may need GNU date (gdate) installed"
|
||||
fi
|
||||
|
||||
# Test perl-based date arithmetic as fallback
|
||||
if [ $PERL_AVAILABLE -eq 1 ]; then
|
||||
echo ""
|
||||
echo "Testing perl-based date arithmetic fallback:"
|
||||
echo "Command: perl -e 'use POSIX qw(strftime); \$time = time() - 3600; print strftime(\"%m-%d-%Y %H:%M:%S\", localtime(\$time))'"
|
||||
PERL_RESULT=$(perl -e 'use POSIX qw(strftime); $time = time() - 3600; print strftime("%m-%d-%Y %H:%M:%S", localtime($time))')
|
||||
echo "SUCCESS: Perl date arithmetic works"
|
||||
echo "Result: $PERL_RESULT"
|
||||
else
|
||||
echo ""
|
||||
echo "WARNING: Perl not available - no fallback for date arithmetic"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Test complete."
|
||||
69
list_mv.ksh
69
list_mv.ksh
@@ -5,44 +5,57 @@
|
||||
# v1.1 - James Pattinson - October 2025
|
||||
#
|
||||
# usage: list_mv.ksh
|
||||
|
||||
|
||||
_SCRIPT_="$0"
|
||||
|
||||
get_script_dir() {
|
||||
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
|
||||
src="$0"
|
||||
while [ -h "$src" ]; do
|
||||
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
|
||||
src=$(readlink "$src")
|
||||
case $src in
|
||||
/*) ;; # absolute path
|
||||
*) src="$dir/$src";;
|
||||
esac
|
||||
done
|
||||
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
|
||||
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/rbk_api.conf
|
||||
|
||||
MYDIR=$(get_script_dir "$_SCRIPT_")
|
||||
. $MYDIR/rubrik.conf
|
||||
. $MYDIR/oracle_funcs.ksh
|
||||
|
||||
# Script starts here
|
||||
|
||||
echo "Service account in use is $ID"
|
||||
|
||||
echo "Managed Volumes"
|
||||
|
||||
echo "Managed Volumes visible to this account:"
|
||||
|
||||
ENDPOINT="https://$RUBRIK_IP/api/internal/managed_volume"
|
||||
rest_api_get
|
||||
|
||||
awk '{
|
||||
pos = 1
|
||||
while (match(substr($0, pos), /"name":"[^"]*"/)) {
|
||||
name = substr($0, pos + RSTART + 7, RLENGTH - 8)
|
||||
# Remove any trailing quote if present
|
||||
sub(/"$/, "", name)
|
||||
print name
|
||||
pos += RSTART + RLENGTH - 1
|
||||
}
|
||||
}' /tmp/rbkresponse.$$
|
||||
awk '
|
||||
{
|
||||
|
||||
line = $0
|
||||
pos = 1
|
||||
while (match(substr(line, pos), /"name":"[^"]*"/)) {
|
||||
start = pos + RSTART + 7
|
||||
len = RLENGTH - 9
|
||||
name = substr(line, start, len)
|
||||
pos += RSTART + RLENGTH - 1
|
||||
if (match(substr(line, pos), /"isWritable":[ ]*(true|false)/)) {
|
||||
start_w = pos + RSTART + 12
|
||||
len_w = RLENGTH - 13
|
||||
writable = substr(line, start_w, len_w)
|
||||
print name ": isWritable=" writable
|
||||
pos += RSTART + RLENGTH - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
' /tmp/rbkresponse.$$
|
||||
|
||||
cleanup
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Oracle shell script support functions
|
||||
# Written for HCL / Nokia
|
||||
# v1.0 - James Pattinson - October 2025
|
||||
# v1.0 - James Pattinson - November 2025
|
||||
|
||||
nowait=0
|
||||
|
||||
@@ -13,15 +13,21 @@ tabwidth=25
|
||||
|
||||
# Portable short hostname function
|
||||
get_short_hostname() {
|
||||
if hostname -s >/dev/null 2>&1; then
|
||||
hostname -s
|
||||
else
|
||||
# Check OS type first - HP-UX hostname doesn't support -s
|
||||
os_type=$(uname -s)
|
||||
if [ "$os_type" = "HP-UX" ]; then
|
||||
hostname | awk -F. '{print $1}'
|
||||
else
|
||||
# Try -s flag on other systems
|
||||
if hostname -s >/dev/null 2>&1; then
|
||||
hostname -s
|
||||
else
|
||||
hostname | awk -F. '{print $1}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
HOST=$(get_short_hostname)
|
||||
|
||||
|
||||
# Detect OS and set DATE variable appropriately
|
||||
os_name=$(uname -s)
|
||||
case "$os_name" in
|
||||
@@ -38,7 +44,6 @@ case "$os_name" in
|
||||
DATE=$(command -v gdate)
|
||||
else
|
||||
DATE=$(command -v date)
|
||||
echo "WARNING: GNU date (gdate) not found. Date arithmetic may not work on HP/UX." >&2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
@@ -50,28 +55,24 @@ echo "`$DATE` -$$-: CALLED $0 $@" >> $LOGFILE
|
||||
|
||||
trap ctrl_c INT
|
||||
|
||||
|
||||
ctrl_c() {
|
||||
echo "`$DATE` -$$-: TRAPPED CTRL-C - EXITING" >> $LOGFILE
|
||||
exit_with_error
|
||||
}
|
||||
|
||||
|
||||
ctrl_c_inhibit() {
|
||||
echo "`$DATE` -$$-: TRAPPED CTRL-C - CONTINUING" >> $LOGFILE
|
||||
}
|
||||
|
||||
exit_with_error() {
|
||||
# if [ $usingsatoken ]; then
|
||||
# ENDPOINT="https://$RUBRIK_IP/api/internal/session/me"
|
||||
# rest_api_delete
|
||||
# check_http_error
|
||||
# fi
|
||||
ENDPOINT="https://$RUBRIK_IP/api/v1/session/me"
|
||||
rest_api_delete
|
||||
check_http_error
|
||||
|
||||
cat /tmp/rbkresponse.$$ | mailx -s "Backup error on ${HOST} for ${ORACLE_SID}. Please investigate" $ALERT_EMAILS
|
||||
#rm -f /tmp/rbkresponse.$$
|
||||
rm -f /tmp/rbkresponse.$$
|
||||
rm -f /tmp/mountedDBs.$$
|
||||
rm -f $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
echo Aborting Script!
|
||||
echo "`$DATE` -$$-: EXITED WITH ERROR $0 $@" >> $LOGFILE
|
||||
exit 1
|
||||
@@ -79,10 +80,11 @@ exit_with_error() {
|
||||
|
||||
check_http_error() {
|
||||
# All good responses start with a 2
|
||||
if [ ${http_response:0:1} != "2" ]; then
|
||||
echo FATAL: HTTP error from API call: $http_response. The server responded with:
|
||||
cat /tmp/rbkresponse.$$ ; echo ; exit_with_error
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
check_pid() {
|
||||
@@ -216,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
|
||||
@@ -225,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
|
||||
@@ -233,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
|
||||
@@ -244,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
|
||||
@@ -261,17 +263,27 @@ 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
|
||||
else
|
||||
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.$$)
|
||||
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.$$)
|
||||
logMvPresent=1
|
||||
echo "INFO: Log volume ($mv_name) exists with $numChannels channels"
|
||||
echo "INFO: Log volume ($mv_name) exists with $numChannels channels"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
set_oracle_env() {
|
||||
ORACLE_HOME=$(awk -F: '$1 == "'$1'" {print $2}' /etc/oratab)
|
||||
PATH=$PATH:$ORACLE_HOME/bin
|
||||
ORACLE_SID=$1
|
||||
if [ -z "$ORACLE_HOME" ]; then
|
||||
echo "ERROR: SID $1 not found in /etc/oratab"
|
||||
exit_with_error
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
open_mv() {
|
||||
@@ -301,12 +313,9 @@ close_mv() {
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
# if [ $usingsatoken ]; then
|
||||
# ENDPOINT="https://$RUBRIK_IP/api/internal/session/me"
|
||||
# rest_api_delete
|
||||
# fi
|
||||
echo "`$DATE` -$$-: EXITED $0 $@" >> $LOGFILE
|
||||
#rm -f /tmp/mountedDBs.$$
|
||||
#rm -f /tmp/rbkresponse.$$
|
||||
ENDPOINT="https://$RUBRIK_IP/api/v1/session/me"
|
||||
rest_api_delete
|
||||
echo "`$DATE` -$$-: EXITED $0 $@" >> $LOGFILE
|
||||
rm -f /tmp/rbkresponse.$$
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
}
|
||||
80
rman_db.ksh
80
rman_db.ksh
@@ -2,40 +2,38 @@
|
||||
#
|
||||
# RMAN DB backup with incremental Merge
|
||||
# Written for HCL / Nokia
|
||||
# v1.0 - James Pattinson - October 2025
|
||||
# v1.0 - James Pattinson - November 2025
|
||||
#
|
||||
# usage: rman_db.ksh <ORACLE_SID>
|
||||
|
||||
_SCRIPT_="$0"
|
||||
|
||||
get_script_dir() {
|
||||
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
|
||||
src="$0"
|
||||
while [ -h "$src" ]; do
|
||||
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
|
||||
src=$(readlink "$src")
|
||||
case $src in
|
||||
/*) ;; # absolute path
|
||||
*) src="$dir/$src";;
|
||||
esac
|
||||
done
|
||||
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
|
||||
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)
|
||||
|
||||
export ORACLE_SID=$1
|
||||
MYDIR=$(get_script_dir "$_SCRIPT_")
|
||||
|
||||
# . $HOME/.profile
|
||||
|
||||
export ORAENV_ASK=NO
|
||||
export ORACLE_SID=$1
|
||||
|
||||
. oraenv
|
||||
|
||||
export ORAENV_ASK=YES
|
||||
|
||||
. $MYDIR/rbk_api.conf
|
||||
. $MYDIR/rubrik.conf
|
||||
. $MYDIR/oracle_funcs.ksh
|
||||
|
||||
#ORACLE_SID=$1
|
||||
set_oracle_env $1
|
||||
|
||||
export NLS_DATE_FORMAT='mm-dd-yyyy hh24:mi:ss'
|
||||
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <DBNAME>]" 1>&2
|
||||
@@ -46,19 +44,13 @@ if [ -z "${ORACLE_SID}" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
#ORAENV_ASK=NO
|
||||
#. oraenv
|
||||
|
||||
export NLS_DATE_FORMAT='mm-dd-yyyy hh24:mi:ss'
|
||||
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||
|
||||
MOUNTPOINT=$MOUNTPOINT_PREFIX/$ORACLE_SID/data
|
||||
|
||||
mkdir -p $RMAN_LOG_DIR/$ORACLE_SID/
|
||||
RMAN_LOG=$RMAN_LOG_DIR/$ORACLE_SID/rman_${ORACLE_SID}_DB_$(date +%d%m%y).log
|
||||
|
||||
# Disk space check
|
||||
dusage=$(df -Ph | egrep "$MOUNTPOINT" | sed s/%//g | awk -v spaceWarn=$MV_SPACE_WARN '{ if($5 >= spaceWarn) print $0;}')
|
||||
dusage=$(df -Pk | grep -E "$MOUNTPOINT" | sed s/%//g | awk -v spaceWarn=$MV_SPACE_WARN '{ if($5 >= spaceWarn) print $0;}')
|
||||
if [ "$dusage" != "" ]; then
|
||||
echo "WARNING: Disk Space Alert - sending email"
|
||||
echo "$dusage" | mailx -s "WARNING: Rubrik MV Disk Space Alert On $(hostname) at $(date)" $ALERT_EMAILS
|
||||
@@ -79,7 +71,12 @@ fi
|
||||
|
||||
echo Running RMAN with log to $RMAN_LOG
|
||||
|
||||
if [ $numChannels -eq 1 ]; then
|
||||
# Default RMAN channels per mount if not set
|
||||
RMAN_CHANNELS_PER_MOUNT=${RMAN_CHANNELS_PER_MOUNT:-1}
|
||||
|
||||
total_channels=$(expr $numChannels \* $RMAN_CHANNELS_PER_MOUNT)
|
||||
|
||||
if [ $total_channels -eq 1 ]; then
|
||||
allocate="allocate channel 'ch1' device type disk format '$MOUNTPOINT/%U';"
|
||||
release="release channel ch1;"
|
||||
channel0="$MOUNTPOINT"
|
||||
@@ -88,15 +85,21 @@ else
|
||||
release=""
|
||||
i=0
|
||||
while [ $i -lt $numChannels ]; do
|
||||
allocate="$allocate allocate channel 'c$i' device type disk format '$MOUNTPOINT/c$i/%U';"
|
||||
release="$release release channel c$i;"
|
||||
j=0
|
||||
while [ $j -lt $RMAN_CHANNELS_PER_MOUNT ]; do
|
||||
suffix=$(echo $j | tr '0123456789' 'abcdefghijklmnopqrstuvwxyz')
|
||||
allocate="$allocate allocate channel 'c${i}${suffix}' device type disk format '$MOUNTPOINT/c$i/%U';"
|
||||
release="$release release channel c${i}${suffix};"
|
||||
j=$(expr $j + 1)
|
||||
done
|
||||
i=$(expr $i + 1)
|
||||
done
|
||||
channel0="$MOUNTPOINT/c0"
|
||||
fi
|
||||
|
||||
|
||||
# Save the current time (minus one hour) to ensure we catch all archive logs
|
||||
startTime=$(date +%m-%d-%Y\ %H:%M:%S -d '-1 hour')
|
||||
startTime=$(perl -e 'use POSIX qw(strftime); $time = time() - 3600; print strftime("%m-%d-%Y %H:%M:%S", localtime($time))')
|
||||
|
||||
# RMAN Part Here
|
||||
###############################################################################
|
||||
@@ -109,6 +112,7 @@ connect target /
|
||||
set echo on;
|
||||
configure retention policy to recovery window of 1 days;
|
||||
run {
|
||||
CONFIGURE BACKUP OPTIMIZATION OFF;
|
||||
set controlfile autobackup format for device type disk to '$channel0/cf_%F';
|
||||
$allocate
|
||||
backup incremental level 1 for recover of copy with tag 'rubrik_snap' database;
|
||||
@@ -137,6 +141,6 @@ elif [ $EMAIL_SUCCESS -eq 1 ]; then
|
||||
fi
|
||||
|
||||
# Change permission of backup files to enable alternate host restore
|
||||
find $MOUNTPOINT -type f -exec chmod 644 {} + 2>/dev/null
|
||||
find $MOUNTPOINT -type f -exec chmod 644 {} \; 2>/dev/null
|
||||
|
||||
close_mv
|
||||
close_mv
|
||||
|
||||
101
rman_logs.ksh
101
rman_logs.ksh
@@ -2,39 +2,38 @@
|
||||
#
|
||||
# RMAN Log backup
|
||||
# Written for HCL / Nokia
|
||||
# v1.1 - James Pattinson - October 2025
|
||||
# v1.1 - James Pattinson - November 2025
|
||||
#
|
||||
# usage: rman_logs.ksh <ORACLE_SID>
|
||||
|
||||
_SCRIPT_="$0"
|
||||
|
||||
get_script_dir() {
|
||||
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
|
||||
src="$0"
|
||||
while [ -h "$src" ]; do
|
||||
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
|
||||
src=$(readlink "$src")
|
||||
case $src in
|
||||
/*) ;; # absolute path
|
||||
*) src="$dir/$src";;
|
||||
esac
|
||||
done
|
||||
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
|
||||
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)
|
||||
export ORACLE_SID=$1
|
||||
|
||||
#. $HOME/.profile
|
||||
MYDIR=$(get_script_dir "$_SCRIPT_")
|
||||
|
||||
export ORAENV_ASK=NO
|
||||
export ORACLE_SID=$1
|
||||
|
||||
. oraenv
|
||||
|
||||
export ORAENV_ASK=YES
|
||||
|
||||
. $MYDIR/rbk_api.conf
|
||||
. $MYDIR/rubrik.conf
|
||||
. $MYDIR/oracle_funcs.ksh
|
||||
|
||||
#ORACLE_SID=$1
|
||||
set_oracle_env $1
|
||||
|
||||
export NLS_DATE_FORMAT='mm-dd-yyyy hh24:mi:ss'
|
||||
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <DBNAME>]" 1>&2
|
||||
@@ -45,27 +44,26 @@ if [ -z "${ORACLE_SID}" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
#ORAENV_ASK=NO
|
||||
#. oraenv
|
||||
|
||||
export NLS_DATE_FORMAT='mm-dd-yyyy hh24:mi:ss'
|
||||
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||
|
||||
mkdir -p $RMAN_LOG_DIR/$ORACLE_SID/
|
||||
RMAN_LOG=$RMAN_LOG_DIR/$ORACLE_SID/rman_${ORACLE_SID}_LOG_$(date +%d%m%y).log
|
||||
|
||||
get_log_mv
|
||||
open_mv
|
||||
|
||||
if [ -z "$numChannels" ]; then
|
||||
echo "WARNING: numChannels not found, setting to 1"
|
||||
numChannels=1
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ERROR: Unable to open MV, aborting
|
||||
exit_with_error
|
||||
fi
|
||||
|
||||
MOUNTPOINT=$MOUNTPOINT_PREFIX/$ORACLE_SID/logs
|
||||
MOUNTPOINT=$MOUNTPOINT_PREFIX/$ORACLE_SID/log
|
||||
|
||||
# Disk space check
|
||||
dusage=$(df -Ph | egrep "$MOUNTPOINT" | sed s/%//g | awk -v spaceWarn=$MV_SPACE_WARN '{ if($5 >= spaceWarn) print $0;}')
|
||||
dusage=$(df -Pk | grep -E "$MOUNTPOINT" | sed s/%//g | awk -v spaceWarn=$MV_SPACE_WARN '{ if($5 >= spaceWarn) print $0;}')
|
||||
if [ "$dusage" != "" ]; then
|
||||
echo "WARNING: Disk Space Alert - sending email"
|
||||
echo "$dusage" | mailx -s "WARNING: Rubrik MV Disk Space Alert On $(hostname) at $(date)" $ALERT_EMAILS
|
||||
@@ -75,15 +73,31 @@ fi
|
||||
|
||||
echo Running RMAN with log to $RMAN_LOG
|
||||
|
||||
allocate=""
|
||||
release=""
|
||||
i=0
|
||||
while [ $i -lt $numChannels ]; do
|
||||
allocate="$allocate allocate channel 'c$i' device type disk format '$MOUNTPOINT/c$i/%U';"
|
||||
release="$release release channel c$i;"
|
||||
i=$(expr $i + 1)
|
||||
done
|
||||
channel0="$MOUNTPOINT/c0"
|
||||
# Default RMAN channels per mount if not set
|
||||
RMAN_CHANNELS_PER_MOUNT=${RMAN_CHANNELS_PER_MOUNT:-1}
|
||||
|
||||
total_channels=$(expr $numChannels \* $RMAN_CHANNELS_PER_MOUNT)
|
||||
|
||||
if [ $total_channels -eq 1 ]; then
|
||||
allocate="allocate channel 'ch1' device type disk format '$MOUNTPOINT/%U';"
|
||||
release="release channel ch1;"
|
||||
channel0="$MOUNTPOINT"
|
||||
else
|
||||
allocate=""
|
||||
release=""
|
||||
i=0
|
||||
while [ $i -lt $numChannels ]; do
|
||||
j=0
|
||||
while [ $j -lt $RMAN_CHANNELS_PER_MOUNT ]; do
|
||||
suffix=$(echo $j | tr '0123456789' 'abcdefghijklmnopqrstuvwxyz')
|
||||
allocate="$allocate allocate channel 'c${i}${suffix}' device type disk format '$MOUNTPOINT/c$i/%U';"
|
||||
release="$release release channel c${i}${suffix};"
|
||||
j=$(expr $j + 1)
|
||||
done
|
||||
i=$(expr $i + 1)
|
||||
done
|
||||
channel0="$MOUNTPOINT/c0"
|
||||
fi
|
||||
|
||||
|
||||
# RMAN Part Here
|
||||
@@ -94,6 +108,7 @@ set echo on;
|
||||
show all;
|
||||
crosscheck backup;
|
||||
run {
|
||||
CONFIGURE BACKUP OPTIMIZATION OFF;
|
||||
set controlfile autobackup format for device type disk to '$channel0/cf_%F';
|
||||
$allocate
|
||||
backup archivelog all not backed up 1 times tag 'rubrik_pit_logs';
|
||||
@@ -116,7 +131,7 @@ elif [ $EMAIL_SUCCESS -eq 1 ]; then
|
||||
fi
|
||||
|
||||
# Change permission of backup files to enable alternate host restore
|
||||
find $MOUNTPOINT -type f -exec chmod 644 {} + 2>/dev/null
|
||||
find $MOUNTPOINT -type f -exec chmod 644 {} \; 2>/dev/null
|
||||
|
||||
close_mv
|
||||
|
||||
@@ -143,4 +158,4 @@ EOF
|
||||
cat $RMAN_LOG | mailx -s "RMAN purge on ${HOST} for ${ORACLE_SID} " $ALERT_EMAILS
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -13,6 +13,11 @@ HOSTLOGRET=2
|
||||
# Percentage threshold to warn if an MV filesystem is getting full
|
||||
MV_SPACE_WARN=75
|
||||
|
||||
# Number of RMAN channels to allocate per MV channel
|
||||
# NOTE: This is not a TOTAL. Total number of RMAN channels will be
|
||||
# this multipled by the number of channels of the Managed Volume
|
||||
RMAN_CHANNELS_PER_MOUNT=1
|
||||
|
||||
# Logging directories
|
||||
|
||||
# API calls
|
||||
@@ -23,4 +28,4 @@ RMAN_LOG_DIR=/tmp/rubrik/rman
|
||||
# List of email addresses to send failure alerts to
|
||||
ALERT_EMAILS=root,oracle
|
||||
# Set to 1 to enable email alert on success also
|
||||
EMAIL_SUCCESS=1
|
||||
EMAIL_SUCCESS=0
|
||||
@@ -10,31 +10,45 @@
|
||||
# -v Volume to operate on, logs or data
|
||||
# -o Operation to perform - open or close the MV
|
||||
|
||||
_SCRIPT_="$0"
|
||||
|
||||
get_script_dir() {
|
||||
# Portable way to get script directory for Linux and HP/UX (ksh compatible)
|
||||
src="$0"
|
||||
while [ -h "$src" ]; do
|
||||
dir=$(cd -P $(dirname "$src") >/dev/null 2>&1 && pwd)
|
||||
src=$(readlink "$src")
|
||||
case $src in
|
||||
/*) ;; # absolute path
|
||||
*) src="$dir/$src";;
|
||||
esac
|
||||
done
|
||||
cd -P $(dirname "$src") >/dev/null 2>&1 && pwd
|
||||
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/rbk_api.conf
|
||||
|
||||
MYDIR=$(get_script_dir "$_SCRIPT_")
|
||||
. $MYDIR/rubrik.conf
|
||||
. $MYDIR/oracle_funcs.ksh
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 -d <DBNAME> -v <logs|data> -o <open|close>" 1>&2
|
||||
echo "Usage: $0 -d <DBNAME> -v <logs|data> -o <open|close>"
|
||||
echo " $0 -n <MV_NAME> -o <open|close>"
|
||||
echo " -d Oracle DBNAME"
|
||||
echo " -v Volume to operate on, logs or data"
|
||||
echo " -o Operation to perform - open or close the MV"
|
||||
echo " -n Specify MV name directly (use only with -o)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
force=0
|
||||
|
||||
while getopts "d:v:o:" o; do
|
||||
|
||||
force=0
|
||||
MVNAME=""
|
||||
|
||||
while getopts "d:v:o:n:" o; do
|
||||
case "${o}" in
|
||||
d)
|
||||
DBNAME=${OPTARG}
|
||||
@@ -45,6 +59,9 @@ while getopts "d:v:o:" o; do
|
||||
o)
|
||||
OPCODE=${OPTARG}
|
||||
;;
|
||||
n)
|
||||
MVNAME=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
@@ -52,20 +69,36 @@ while getopts "d:v:o:" o; do
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ -z "${DBNAME}" ] || [ -z "${VOLUME}" ] || [ -z "${OPCODE}" ]; then
|
||||
# Validate options
|
||||
if [ -n "$MVNAME" ]; then
|
||||
# Direct MV name mode: require -n and -o only
|
||||
if [ -z "$OPCODE" ]; then
|
||||
usage
|
||||
fi
|
||||
mv_name="$MVNAME"
|
||||
elif [ -n "$DBNAME" ] && [ -n "$VOLUME" ] && [ -n "$OPCODE" ]; then
|
||||
# Standard mode: require -d, -v, -o
|
||||
mv_name=$(get_short_hostname)_${DBNAME}_${VOLUME}
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
||||
# Script starts here
|
||||
|
||||
get_short_hostname() {
|
||||
if hostname -s >/dev/null 2>&1; then
|
||||
hostname -s
|
||||
else
|
||||
# Check OS type first - HP-UX hostname doesn't support -s
|
||||
os_type=$(uname -s)
|
||||
if [ "$os_type" = "HP-UX" ]; then
|
||||
hostname | awk -F. '{print $1}'
|
||||
else
|
||||
# Try -s flag on other systems
|
||||
if hostname -s >/dev/null 2>&1; then
|
||||
hostname -s
|
||||
else
|
||||
hostname | awk -F. '{print $1}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
mv_name=$(get_short_hostname)_${DBNAME}_${VOLUME}
|
||||
|
||||
get_mv
|
||||
|
||||
case $OPCODE in
|
||||
|
||||
50
test.ksh
Executable file
50
test.ksh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/ksh
|
||||
echo "Testing HP-UX compatibility for Rubrik scripts..."
|
||||
|
||||
# Check for required commands
|
||||
for cmd in ksh awk readlink egrep date dfsdf expr mkdir; do
|
||||
if ! command -v $cmd >/dev/null 2>&1; then
|
||||
echo "ERROR: $cmd not found in PATH"
|
||||
else
|
||||
echo "OK: $cmd found"
|
||||
fi
|
||||
done
|
||||
|
||||
# Test awk JSON extraction for numChannels
|
||||
echo '{"numChannels": 4, "foo": "bar"}' > /tmp/testjson.$$
|
||||
numChannels=$(awk '{match($0, /"numChannels":[ ]*[0-9]+/); if (RSTART > 0) {val=substr($0, RSTART, RLENGTH); sub(/.*:[ ]*/, "", val); print val}}' /tmp/testjson.$$)
|
||||
if [ "$numChannels" = "4" ]; then
|
||||
echo "OK: awk numChannels extraction works"
|
||||
else
|
||||
echo "ERROR: awk numChannels extraction failed (got '$numChannels')"
|
||||
fi
|
||||
|
||||
# Test awk JSON extraction for ManagedVolume
|
||||
echo '{"id":"ManagedVolume:::abc-123-xyz"}' > /tmp/testjson.$$
|
||||
mvId=$(awk '{match($0, /ManagedVolume:::[a-z0-9-]*/); if (RSTART > 0) {id=substr($0, RSTART, RLENGTH); sub(/"$/, "", id); print id}}' /tmp/testjson.$$)
|
||||
if [ "$mvId" = "ManagedVolume:::abc-123-xyz" ]; then
|
||||
echo "OK: awk ManagedVolume extraction works"
|
||||
else
|
||||
echo "ERROR: awk ManagedVolume extraction failed (got '$mvId')"
|
||||
fi
|
||||
|
||||
# Test readlink
|
||||
ln -s /tmp/testjson.$$ /tmp/testlink.$$
|
||||
linkres=$(readlink /tmp/testlink.$$ 2>/dev/null)
|
||||
if [ "$linkres" = "/tmp/testjson.$$" ]; then
|
||||
echo "OK: readlink works"
|
||||
else
|
||||
echo "WARNING: readlink did not return expected result (got '$linkres')"
|
||||
fi
|
||||
rm -f /tmp/testjson.$$ /tmp/testlink.$$
|
||||
|
||||
# Test expr arithmetic
|
||||
i=0
|
||||
i=$(expr $i + 1)
|
||||
if [ "$i" = "1" ]; then
|
||||
echo "OK: expr arithmetic works"
|
||||
else
|
||||
echo "ERROR: expr arithmetic failed"
|
||||
fi
|
||||
|
||||
echo "Testing complete."
|
||||
Reference in New Issue
Block a user