shell

Linux


mdfile.sh

#!/bin/sh

TMPFILE=/tmp/benkeitmp.$$
BASE=/mnt_nfs/ben/02/v2data
#BASE=/backup/export/data/v2data
DATA=files

cd $BASE
ls -1 $DATA | sort > $TMPFILE
filename=$TMPFILE

cd $DATA
cat ${filename} | while read line
do
  if [ -z "$(ls -A ${line}/)" ]
  then
  echo "${line}"
  else
  ls -1 ${line}/* | sort | xargs md5sum
  fi
done

rm -f $TMPFILE

isPrimay.sh

#!/bin/sh

TARGET="10.97.10.3"
IP=`ip -4 -o addr show dev eth0 | awk '{print $4}' | cut -d/ -f1`

for inetaddr in $IP; do
# echo $inetaddr
  if [ $TARGET = "$inetaddr" ]; then
  exit 0
  fi
 done

exit 1

sync-updata.sh

#!/bin/sh

export LC_ALL=C
BACKUPDIR=/mnt_nfs/ben/03/v2data/
SRCDIR=/mnt_nfs/ben/02/v2data/
LOG=/var/log/RSYNC.log

## node check
/opt/benkei/bin/isPrimay.sh
RET=$?

if [ $RET = 1 ]; then
  echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\": is Standby Node"
  exit 1
 fi

## sync start
echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\": Synchronization Start"

/usr/bin/rsync -auxH --delete \
  $SRCDIR $BACKUPDIR
RET=$?

echo -n "#Sync Result: "

case $RET in
   0 | 24 )
  echo "Success"
   ;;
  *)
   echo "failure "
   echo "Return Code: $RET"
   ;;
 esac

 echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\": Synchronization End"

oracle_dev_startup.sh

#!/bin/sh
# Oracle startup Script
#
set -x

crs_stat -t
srvctl start listener -n ben90db1 -l LISTENER_BEN01_BEN90DB1
srvctl start listener -n ben90db1 -l LISTENER_BEN02_BEN90DB1
srvctl start listener -n ben90db1 -l LISTENER_BEN90DB1
srvctl start listener -n ben90db2 -l LISTENER_BEN01_BEN90DB2
srvctl start listener -n ben90db2 -l LISTENER_BEN02_BEN90DB2
srvctl start listener -n ben90db2 -l LISTENER_BEN90DB2
srvctl start asm -n ben90db1
srvctl start asm -n ben90db2
srvctl start database -d benkeidev
srvctl start nodeapps -n ben90db1
srvctl start nodeapps -n ben90db2
crs_stat -t

oracleインポート用

#!/bin/bash
export NLS_LANG=japanese_Japan.JA16SJISTILDE
export ORACLE_SID=benkei01
export ORACLE_HOME=/opt/oracle/product/10.2.0/db
export PATH=$PATH:${ORACLE_HOME}/bin

ORA=/opt/oracle/product/10.2.0/db
BIN=$ORA/bin

$BIN/imp 'system/!qaz2wsx' \
FILE=/home/oracle/bin/exp_benkeiv2.dmp \
FROMUSER=benkeiv2 TOUSER=benkeiv2 GRANTS=y ROWS=y IGNORE=y DESTROY=y

oracleエクスポート用

#!/bin/bash
export NLS_LANG=japanese_Japan.JA16SJISTILDE
export ORACLE_SID=benkei
export ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1
export PATH=$PATH:${ORACLE_HOME}/bin

BIN=$ORACLE_HOME/bin

$BIN/exp system/Oracle10! \
FILE=/backup/oracle/export/exp_benkeiv2.dmp \
LOG=/backup/oracle/export/exp_benkeiv2.log \
OWNER=benkeiv2 GRANTS=y ROWS=y COMPRESS=y STATISTICS=NONE


oracle_backup_online.sh

#!/bin/sh
# Online Backup via RMAN

export ORACLE_SID=benkei
export ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1
export PATH=$PATH:${ORACLE_HOME}/bin
export LC_ALL=C

## Node check
if [ ! -d /u02/oracle/oradata ]; then
 echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\": is Standby Node"
  exit 1
fi
if [ ! -d /backup/oracle ]; then
 echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\": is Standby Node"
  exit 1
fi

## Oracle Backup start
echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\":"
echo "--- RMAN online backup start --- "

# online backup
rman target / cmdfile /home/oracle/rman/daily_backup.cmd

echo "$(date '+%Y %b %e %T') - Node \"$(hostname)\":"
echo "--- RMAN online backup end --- "
echo

証明書チェック pair_check.sh

#! /bin/sh

openssl x509 -in a.crt.pem -noout -modulus > crt.txt>
openssl rsa -in b.key.pem -noout -modulus > key.txt
diff crt.txt key.txt

cat /dev/null > a.crt.pem ; cat /dev/null > b.key.pem

a.crt.pem b.key.pem crt.txt key.txtのファイルを作成しておく

  • 最終更新:2017-02-18 13:12:41

このWIKIを編集するにはパスワード入力が必要です

認証パスワード