后台执行

nohup 让程序永远后台执行

引用
 功能:使进程在退出登录后仍旧继续执行。
  格式:$ nohup <程序名> &
  结果:如果程序program有结果输出,输出结果将会被保存到当前目录下的一个文件名为 nohup.out的文件中,如果用户在当前目录没有写的权限, 则结果将会被保存到用户主目录下的nohup.out文件中。
  举例:
  # nohup ./exp.sh &
  nohup: appending output to `nohup.out'
  今天做一个exp备份,让备份后台执行.用nohup来实现
  exp脚本:
  !/bin/bash
  #Made by Eagle
  ORACLE_SID=eagle
  date=`date -u +%y%m%d`
  time=`date -u +%a`
  user=system
  passwd=sys
  NLS_LANG="SIMPLIFIED CHINESE_CHINA".ZHS16GBK
  export NLS_LANG
  data=/databak/exp/data/$date.dmp
  log=/databak/exp/log/$date.log
  if
   [ $time = "Mon" ]
  then
   exp $user/$passwd@$ORACLE_SID inctype=complete file=$data log=$log feedback=100000 buffer=65536
  else
   [ $time = "Tue" ]
   exp $user/$passwd@$ORACLE_SID inctype=incremental file=$data log=$log feedback=100000 buffer=65536
  ****** //类似
  运行:
  [oracle@eagle proc]$ nohup ./exp.sh &
  [1] 7211
  nohup: appending output to `nohup.out'
  [oracle@eagle proc]$

猜你喜欢

转载自iaiai.iteye.com/blog/1103042