Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /www/wwwroot/zhujipindao.com/wp-includes/wp-db.php on line 2056
如何在Linux中使用nohup命令-主机频道
关注分享主机优惠活动
国内外VPS云服务器

如何在Linux中使用nohup命令


Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /www/wwwroot/zhujipindao.com/wp-includes/wp-db.php on line 2056

Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /www/wwwroot/zhujipindao.com/wp-includes/wp-db.php on line 2056

本文主要讲解“如何在Linux中使用nohup命令”。感兴趣的朋友不妨看看。本文介绍的方法简单、快速、实用。下面就让主机频道带你学习一下如何在Linux中使用nohup命令吧!什么是nohup nohup是Linux和Unix系统中的一个命令,它的作用是在终端退出时保持进程在后台运行。它的全称是“no hang up”,意思是“不要挂断”Nohup命令允许您在退出终端或关闭SSH连接后继续运行该命令。nohup命令的基本语法如下:nohup & nbsp命令& nbsp【ARGS & nbsp;...]& nbsp;[& gt;& nbsp输出文件2 & gt& nbsp错误-文件]& nbsp;& amp参数具有以下含义:命令:需要在后台运行的命令或脚本。ARGS:命令或脚本的参数。& gt输出文件:输出被重定向到指定的文件。2 & gtError-file:错误信息被重定向到指定的文件。& amp:在后台运行命令。nohup命令的执行过程分为以下步骤:nohup命令将当前shell的所有标准输入、标准输出和标准错误输出重定向到/dev/null设备,以避免被关闭终端的信号中断。Nohup命令将进程放在后台,并将进程的PID输出到终端。该进程开始执行,并将标准输出和标准错误输出重定向到指定的文件。用户可以退出终端或关闭终端窗口,进程仍在后台运行。如何使用nohup使用nohup命令非常简单,按照上面的基本语法就可以了。以下是nohup命令使用的一些例子:在后台运行命令要在后台运行命令,只需在命令行输入以下命令:nohup & nbsp命令& nbsp& amp例如,在后台运行一个Bash脚本:nohup。bash & nbsptest.sh & nbsp& amp标准输出被重定向到文件nohup。bash & nbsptest.sh & nbsp& gt& nbspstdout.txt & nbsp& amp标准错误输出被重定向到文件NOHUP。bash & nbsptest.sh & nbsp2 & gt& nbspstderr.txt & nbsp& amp将标准输出和标准错误输出重定向到文件1。重定向至同一文件NOHUP。bash & nbsptest.sh & nbsp& gt& nbspoutput.txt & nbsp2 & gt& amp1 & nbsp& amp2.重定向到不同的文件nohup & nbspbash & nbsptest.sh & nbsp& gt& nbspstdout.txt & nbsp2 & gt& nbspstderr.txt & nbsp& amp3.更复杂的例子,重定向标准输入(STDIN):NOHUP & nbsp;。/my program & nbsp;& gt& nbspfoo.out & nbsp2 & gt& nbspfoo.err & nbsp& lt& nbsp/dev/null & nbsp;& amp这里还有一个

未经允许不得转载:主机频道 » 如何在Linux中使用nohup命令

相关推荐

  • 暂无文章

评论 抢沙发

评论前必须登录!