Search code examples
unixnohup

unix nohup sqlplus not working


Trying to run all of the sql scripts in one NOHUP command. Below is my code. But, it is not running in nohup mode based on the below. There are no errors either. How do I run all of the below in one NOHUP command??

nohup sqlplus -S /NOLOG << %EOF% > engine_error.log
WHENEVER SQLERROR EXIT 1;
@$Level2/passFile server05
@engine_check.sql $stroke1 $bore1 
@engine_start.sql 
%EOF% &

Solution

  • When you have a script that must start some background jobs, make a script that starts functions with & and nohup your script.
    When your script startit.sh looks like

    function f1 {
       echo "f1 start"
       sleep 2
       echo "f1 end"
    }
    
    function f2 {
       echo "f2 start"
       sleep 1
       echo "f2 end"
    }
    
    function f3 {
       echo "f3 start"
       sleep 1
       cat <<END
    f3 start here
    more f3
    f3 end here
    END
       echo "f3 end"
    }
    
    f1 &
    f2
    f3 &
    

    call nohup startit.sh.