Re: Need some simple help with nohupping a SQLplus script from within a BASH script
From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Wed, 25 Sep 2013 19:34:21 +0200
Message-ID: <52431E9D.2050003_at_gmail.com>
On 25/09/2013 18:55, Chris Taylor wrote:
> Is there a way to do a nohup in a loop so that the uname/password doesn't
> show up on the ps list? I thought about assigning it to a variable but
> that doesn't really work to hide the username password either.
[...]
[3] 28467
[4] 28468
Sending output to nohup.out
28465 nohup sqlplus -s
28468 pgrep -lf sqlplus -sSending output to nohup.out Sending output to nohup.out
28465 nohup sqlplus -s
28466 pgrep -lf sqlplus -s
28467 sqlplus -s
28469 sqlplus -s
[6] 28470
$ cat nohup.out
Date: Wed, 25 Sep 2013 19:34:21 +0200
Message-ID: <52431E9D.2050003_at_gmail.com>
On 25/09/2013 18:55, Chris Taylor wrote:
> Is there a way to do a nohup in a loop so that the uname/password doesn't
> show up on the ps list? I thought about assigning it to a variable but
> that doesn't really work to hide the username password either.
[...]
Hi Chris,
you can use the following syntax:
nohup sqlplus -s << EOF & >> $logfile </dev/null
$v_user/$v_pass
_at_$sqlfile $table_name
EOF
Something like this:
$ set +m
$ for dummy_user in 1 2 3; do
> nohup sqlplus -s <<! & >> _logfile_ 2>&1 </dev/null > $dummy_user/ as sysdba > select $dummy_user from dual; > ! > pgrep -lf 'sqlplus -s' & > done [1] 28465 [2] 28466
[3] 28467
[4] 28468
Sending output to nohup.out
28465 nohup sqlplus -s
28468 pgrep -lf sqlplus -sSending output to nohup.out Sending output to nohup.out
28465 nohup sqlplus -s
28466 pgrep -lf sqlplus -s
28467 sqlplus -s
28469 sqlplus -s
28467 sqlplus -s
28469 sqlplus -s
[5] 28469
28465 sqlplus -s 28467 sqlplus -s 28469 sqlplus -s
[6] 28470
$ cat nohup.out
1
1
2
2
3
3
Note that you don't need to run each command in nohup, but only the parent script (if you use one)):
nohup ./script_name > logfile 2>&1 &
Regards
Dimitre
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Sep 25 2013 - 19:34:21 CEST