내 스크립트 :nohup을 사용하여 명령을 혼동하면 안 되니?
#!/bin/bash
. /home/was/.bash_profile
export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/was/bin:/wasdata/oracle/10.2.0/client_1/bin:
sqlplus "mon_system/[email protected]" <<eof
set echo off
set feedback off
set serveroutput on
set term off
set sqlprompt ""
set linesize 200
spool /wasdata/scripts/systeminf/tmp-was-restart.sh
exec prc_auto_restart
eof
sed -i '/prc_auto_restart/d' tmp-was-restart.sh
/wasdata/scripts/systeminf/tmp-was-restart.sh
cat /dev/null>/wasdata/scripts/systeminf/tmp-was-restart.sh
과정은 다음과 같습니다 데이터베이스에 1 로그인 절차 "prc_auto_restart" 2 프로 시저를 실행하기 위해 출력합니다 "/wasdata/scripts/systeminf/tmp-was-restart.sh 제가
SCRI 실행할 때ssh [email protected] "ps -ef|grep was1.*WebSphere.*c01_ship_s01|grep -v "grep">>kill.log;ps -ef|grep was1.*WebSphere.*c01_ship
_s01|grep -v "grep"|awk '{print \"kill -9 \" \$2}'|sh"
값 : tmp-was-restart.sh 원하는 것
"/wasdata/scripts/systeminf/tmp-was-restart.sh" 3 실행 " 그것은, 그것은 두 개의 쉘을 포크 것
[[email protected] systeminf]$ nohup prod-auto-restart.sh &
[1] 29983
[[email protected] systeminf]$ nohup: appending output to `nohup.out'
[1]+ Stopped nohup prod-auto-restart.sh
[[email protected] systeminf]$
[[email protected] systeminf]$
[[email protected] systeminf]$ ps -ef|grep autp
was 30014 27492 0 16:33 pts/4 00:00:00 grep autp
[[email protected] systeminf]$ ps -ef|grep auto
was 29983 27492 0 16:33 pts/4 00:00:00 /bin/bash prod-auto-restart.sh
was 30003 29983 0 16:33 pts/4 00:00:00 /bin/bash prod-auto-restart.sh
was 30021 27492 0 16:33 pts/4 00:00:00 grep auto
, 그리고 나는 tmp-was-restart.sh을 확인하십시오
[[email protected] systeminf]$ ./prod-auto-restart.sh
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 6 16:33:08 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> SQL> SQL> SQL> SQL> ssh -t -t [email protected] "ps -ef|grep was1.*WebSphere.*c01_ship_s01|grep -v "grep">>kill.log;ps -ef|grep was1.*WebSphere.*c01_ship_s01|grep -v "grep"|awk '{print \"kill -9 \" \$2}'|sh"
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Connection to 10.10.4.212 closed.
[[email protected] systeminf]$
을하지만 난 스크립트를 실행 nohup을 사용하는 경우 : PT 직접 스크립트가 작동 올바른지, 그리고"sed -i '/ prc_auto_restart/d'tmp-was-restart.sh"명령이 올바르게 실행되고 "/wasdata/scripts/systeminf/tmp-was-restart.sh" , 나는/프로세스를 29983, "/wasdata/scripts/systeminf/tmp-was-restart.sh"명령이 실행되지만, "cat/dev/null> wasdata/scripts/systeminf/tmp-was-restart.sh "아닙니다 execu 매우 혼란스러운 ted!
누구든지이 사실을 알고 있습니까? – koko