想要重定向nohup命令的输出

时间:2017-05-19 07:56:06

标签: bash shell unix sh ksh

我正在执行一个shell脚本来启动服务。 在脚本里面我使用nohup命令来启动服务但是我的输出被重定向到nohup.out文件有什么想法吗? 我在下面提供我的代码

  #!/usr/bin/ksh
     echo "===========================================================================
 ==" | tee -a /opt/users/Feroz/tools_boot.log |echo $(date '+%d-%m-%y  %H:%M:%S') "Starting Weblogic services" | tee -a /opt/users/Feroz/tools_boot.log
     ##
     # Set up Working directory for Weblogic 
     #   
     cd /feroz/weblogic_apps/environment/bin
    echo $(date '+%d-%m-%y %H:%M:%S') "Starting Weblogic services environment" |tee -a /opt/users/Feroz/tools_boot.log
     cmd="nohup ./startNodeManager.sh  >startNodeManager.out 2>&1 &"
     echo ^M |$cmd
     #sleep 10
     #cmd="nohup ./startWebLogic.sh >startWebLogic.out 2>&1 &"
     #echo ^M|$cmd 

     echo $(date '+%d-%m-%y %H:%M:%S') "Weblogic services INT environment 
     Started" |tee -a /opt/users/Feroz/tools_boot.log

    echo "Successful"

输出

   19-05-17 02:37:59 Starting Weblogic service
   19-05-17 02:37:59 Starting Weblogic services environment
   nohup: appending output to `nohup.out'
   19-05-17 02:38:02 Weblogic services environment Started
   Successful

0 个答案:

没有答案