zoukankan      html  css  js  c++  java
  • 后台运行-nohup,&

    &

    sh shell.sh &

    该命令会使sh shell.sh命令在该终端后台运行,但是当关闭该终端时后台运行命令也将被关闭。

    sh shell.sh >out.log &
    >file为标准输出重定向到file中
    2>file为将错误重定向到file中
    2>&1为将错误重定向到标准输出中
    

    所以可以使用 sh shell.sh >out.log 2>&1 &表示后台执行shell.sh并把标准输出和错误输出打印到out.log文档中

    nohup

    表示挂起一般配合&使用,可以达到关闭终端仍在运行的效果。

    nohup sh shell.sh >out.log &

    表示后台运行sh shell.sh命令,并将标准输出打印到out.log,当关闭终端时仍可以运行。

  • 相关阅读:
    leetcode-409
    leetcode-836
    leetcode-1160
    leetcode-面试题13
    leetcode-695
    go的一些小lib
    leetcode-300
    cookie
    php上传文件
    PHP 文件创建/写入
  • 原文地址:https://www.cnblogs.com/Wuser/p/12249817.html
Copyright © 2011-2022 走看看