{"id":1163,"date":"2025-09-04T09:56:14","date_gmt":"2025-09-04T01:56:14","guid":{"rendered":"https:\/\/www.vcidc.net\/blog\/?p=1163"},"modified":"2025-09-04T09:56:14","modified_gmt":"2025-09-04T01:56:14","slug":"%e6%b7%b1%e5%85%a5%e4%ba%86%e8%a7%a3nohup%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.vcidc.net\/blog\/1163.html","title":{"rendered":"\u6df1\u5165\u4e86\u89e3nohup\u547d\u4ee4"},"content":{"rendered":"<p><h3>nohup\u547d\u4ee4\u7b80\u4ecb<\/h3>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.vcidc.net\/blog\/wp-content\/uploads\/2025\/07\/kgXo4Sf.jpg\" alt=\"\u6df1\u5165\u4e86\u89e3nohup\u547d\u4ee4\" title=\"\u6df1\u5165\u4e86\u89e3nohup\u547d\u4ee4\"><\/p>\n<p><p>nohup\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u7528\u4e8e\u5728\u540e\u53f0\u8fd0\u884c\u547d\u4ee4\u7684\u4e00\u79cd\u5b9e\u7528\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u7528\u6237\u5728\u547d\u4ee4\u6267\u884c\u5b8c\u6210\u540e\u7ee7\u7eed\u8fd0\u884c\uff0c\u800c\u4e0d\u53d7\u7ec8\u7aef\u4f1a\u8bdd\u7684\u5e72\u6270\u3002nohup\u7684\u5168\u79f0\u662f\u201cno hang up\u201d\uff0c\u610f\u5473\u7740\u5373\u4f7f\u7528\u6237\u9000\u51fa\u4e86\u7ec8\u7aef\uff0c\u547d\u4ee4\u4e5f\u4f1a\u7ee7\u7eed\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u63a8\u8350\u6392\u5e8f\u7684\u4f7f\u7528\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662fnohup\u547d\u4ee4\u63a8\u8350\u7684\u6392\u5e8f\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><pre><code>nohup command &<\/code><\/pre>\n<\/li>\n<li>\n<p><pre><code>nohup command > output.log 2>&1 &<\/code><\/pre>\n<\/li>\n<li>\n<p><pre><code>nohup command &<\/code><\/pre>\n<\/li>\n<\/ol>\n<p><h3>\u547d\u4ee4\u7684\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>nohup\u547d\u4ee4\u7684\u57fa\u672c\u7528\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><pre><code>nohup command<\/code><\/pre>\n<\/li>\n<li>\n<p><pre><code>nohup command &<\/code><\/pre>\n<\/li>\n<li>\n<p><pre><code>nohup command > output.log 2>&1 &<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><h3>\u8f93\u51fa\u91cd\u5b9a\u5411\u548c\u9519\u8bef\u91cd\u5b9a\u5411<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528nohup\u547d\u4ee4\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8f93\u51fa\u91cd\u5b9a\u5411\u548c\u9519\u8bef\u91cd\u5b9a\u5411\u6765\u5c06\u547d\u4ee4\u7684\u8f93\u51fa\u548c\u9519\u8bef\u8f93\u51fa\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><pre><code>nohup command > output.log<\/code><\/pre>\n<p>\uff1a\u5c06\u547d\u4ee4\u7684\u8f93\u51fa\u91cd\u5b9a\u5411\u5230output.log\u6587\u4ef6\u4e2d\u3002<\/li>\n<\/p>\n<li>\n<p><pre><code>nohup command 2>&1<\/code><\/pre>\n<p>\uff1a\u5c06\u547d\u4ee4\u7684\u6807\u51c6\u8f93\u51fa\u548c\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u5408\u5e76\uff0c\u5e76\u91cd\u5b9a\u5411\u5230\u540c\u4e00\u6587\u4ef6\u4e2d\u3002<\/li>\n<\/p>\n<\/ul>\n<p><h3>\u540e\u53f0\u8fd0\u884c\u547d\u4ee4<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528nohup\u547d\u4ee4\u53ef\u4ee5\u5728\u540e\u53f0\u8fd0\u884c\u547d\u4ee4\uff0c\u5373\u4f7f\u7528\u6237\u9000\u51fa\u4e86\u7ec8\u7aef\uff0c\u547d\u4ee4\u4e5f\u4f1a\u7ee7\u7eed\u6267\u884c\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><pre><code>nohup command &<\/code><\/pre>\n<p>\uff1a\u5728\u547d\u4ee4\u6267\u884c\u5b8c\u6210\u540e\uff0c\u4f7f\u7528&#038;\u7b26\u53f7\u5c06\u547d\u4ee4\u653e\u5728\u540e\u53f0\u8fd0\u884c\u3002<\/li>\n<\/p>\n<\/ul>\n<p><h3>\u67e5\u770bnohup\u547d\u4ee4\u7684\u8fdb\u7a0b<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528nohup\u547d\u4ee4\u8fd0\u884c\u547d\u4ee4\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0b\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><pre><code>ps -ef | grep nohup<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><h3>nohup\u547d\u4ee4\u7684\u9000\u51fa<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u505c\u6b62\u4f7f\u7528nohup\u547d\u4ee4\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<ul>\n<li>\n<p><pre><code>kill -9 PID<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><p>\u5176\u4e2d\uff0cPID\u662f\u4f7f\u7528ps\u547d\u4ee4\u67e5\u8be2\u5230\u7684\u8fdb\u7a0bID\u3002<\/p>\n<p><b>\u95ee\u98981\uff1a<\/b>nohup\u547d\u4ee4\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f<\/p>\n<p><p>nohup\u547d\u4ee4\u5141\u8bb8\u7528\u6237\u5728\u540e\u53f0\u8fd0\u884c\u547d\u4ee4\uff0c\u5373\u4f7f\u7ec8\u7aef\u4f1a\u8bdd\u5df2\u7ecf\u5173\u95ed\uff0c\u547d\u4ee4\u4e5f\u4f1a\u7ee7\u7eed\u6267\u884c\u3002<\/p>\n<\/p>\n<p><b>\u95ee\u98982\uff1a<\/b>\u5982\u4f55\u5c06\u547d\u4ee4\u7684\u8f93\u51fa\u548c\u9519\u8bef\u8f93\u51fa\u5230\u540c\u4e00\u4e2a\u6587\u4ef6\uff1f<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\uff1anohup command 2>&#038;1 > output.log &#038;<\/p>\n<\/p>\n<p><b>\u95ee\u98983\uff1a<\/b>\u5982\u4f55\u67e5\u770b\u4f7f\u7528nohup\u547d\u4ee4\u8fd0\u884c\u7684\u8fdb\u7a0b\uff1f<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\uff1aps -ef | grep nohup<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>nohup\u547d\u4ee4\u7b80\u4ecb nohup\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u7528\u4e8e\u5728\u540e\u53f0\u8fd0\u884c\u547d\u4ee4\u7684\u4e00\u79cd\u5b9e\u7528\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u7528\u6237\u5728\u547d\u4ee4\u6267\u884c\u5b8c\u6210\u540e\u7ee7\u7eed\u8fd0\u884c\uff0c\u800c\u4e0d\u53d7\u7ec8\u7aef\u4f1a\u8bdd\u7684\u5e72\u6270\u3002nohup\u7684\u5168\u79f0\u662f\u201cno hang up\u201d\uff0c\u610f\u5473\u7740\u5373\u4f7f\u7528\u6237\u9000\u51fa\u4e86\u7ec8\u7aef\uff0c\u547d\u4ee4\u4e5f\u4f1a\u7ee7\u7eed\u6267\u884c\u3002 \u63a8\u8350\u6392&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1164,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[435,434,72],"topic":[],"class_list":["post-1163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tw-server","tag-command","tag-nohup","tag-72"],"_links":{"self":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/1163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/comments?post=1163"}],"version-history":[{"count":1,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/1163\/revisions"}],"predecessor-version":[{"id":1166,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/1163\/revisions\/1166"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/media\/1164"}],"wp:attachment":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/media?parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/tags?post=1163"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/topic?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}