- 论坛徽章:
- 0
|
大概情况如下
1、一台AIX,安装的NBU软件
2、有全备份和日志备份两个脚本,在日志备份的脚本中添加了如下的判断语句
1 PROGNAME=$0
2 RUNNING_CHECK_NAME="$PROGNAME"
3 FULLBACKUP_CHECK_NAME="/usr/openv/scripts/${ORACLE_SID}_hot_database_backup.sh"
4 echo "FULLBACKUP_CHECK_NAME" is $FULLBACKUP_CHECK_NAME >> $RMAN_LOG_FILE
5 /usr/bin/ps -ef|/usr/bin/egrep "$RUNNING_CHECK_NAME|$FULLBACKUP_CHECK_NAME"|grep -v grep >>$RMAN_LOG_FILE
6 RUNSLINE=`/usr/bin/ps -ef|/usr/bin/egrep "$RUNNING_CHECK_NAME|$FULLBACKUP_CHECK_NAME"|grep -v grep`
7 echo "RUNSLINE" >>$RMAN_LOG_FILE
8 echo "$RUNSLINE" >>$RMAN_LOG_FILE
9 RUNS=`/usr/bin/ps -ef|/usr/bin/egrep "$RUNNING_CHECK_NAME|$FULLBACKUP_CHECK_NAME"|grep -vc grep`
10 echo "RUNS" >>$RMAN_LOG_FILE
11 echo "$RUNS" >>$RMAN_LOG_FILE
12 if [ $RUNS -gt 1 ]
13 then
14 echo "FULL BACKUP or ARACHIVELOG BACKUP IS RUNNING, RUNS is $RUNS, Exit" >>$RMAN_LOG_FILE
15 /usr/bin/ps -ef|/usr/bin/egrep "$RUNNING_CHECK_NAME|$FULLBACKUP_CHECK_NAME"|grep -v grep >>$RMAN_LOG_FILE
16 exit 0
17 fi |
目的是判断此脚本在运行时同时还有其他的全备份和日志备份在跑就退出
现在存在的问题是判断的语句有点问题,大家看一下输出结果
FULLBACKUP_CHECK_NAME is /usr/openv/scripts/orasjjz_hot_database_backup.sh
root 1478792 1171704 0 22:30:26 pts/1 0:00 /bin/sh /usr/openv/scripts/orasjjz_archivelog_backup.sh
RUNSLINE
root 1364164 1478792 0 22:30:26 pts/1 0:00 /bin/sh /usr/openv/scripts/orasjjz_archivelog_backup.sh
root 1478792 1171704 0 22:30:26 pts/1 0:00 /bin/sh /usr/openv/scripts/orasjjz_archivelog_backup.sh
RUNS
2
FULL BACKUP or ARACHIVELOG BACKUP IS RUNNING, RUNS is 2, Exit
root 1478792 1171704 1 22:30:26 pts/1 0:00 /bin/sh /usr/openv/scripts/orasjjz_archivelog_backup.sh
本来明明只有一条命令的,当进行RUNSLINE=`。。。`和RUNS=`。。。`赋值时却变成了两条,结果就会退出执行
不知道问题描述清楚了没有,大家帮忙看看可能是什么地方出了问题呢? |
|