{"id":270761,"date":"2023-04-27T20:06:17","date_gmt":"2023-04-27T12:06:17","guid":{"rendered":"https:\/\/lrxjmw.cn\/lxszkjqddjzf.html"},"modified":"2023-04-27T20:06:17","modified_gmt":"2023-04-27T12:06:17","slug":"lxszkjqddjzf","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lxszkjqddjzf.html","title":{"rendered":"Linux\u4e0b\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u7684\u51e0\u79cd\u65b9\u6cd5"},"content":{"rendered":"

Linux<\/a>\u4e0b\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u7684\u51e0\u79cd\u65b9\u5f0f1\u66f4\u6539\/etc\/rc.d\/rc.local\u6587\u4ef6\u628a\u81ea\u542f\u52a8\u811a\u672c\u7f6e\u4e8e\/etc\/profile.d\/\u4e0b<\/p>\n

\u4e3a\u4e86\u4fdd\u8bc1\u4e00\u5b9a\u80fd\u6267\u884cLINUX \u5220\u9664\u76ee\u5f55\uff0c\u6700\u597d\u518d\u52a0\u4e2a\u8d4b\u6743\u64cd\u4f5c<\/p>\n

server2003\u5982\u4f55\u5c06\u7a0b\u5e8f\u8bbe\u7f6e\u6210\u5f00\u673a\u542f\u52a8_linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8_\u5982\u4f55\u628a\u67d0\u4e2a\u7a0b\u5e8f\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8<\/p>\n

chmod+x\/etc\/profile.d\/test01.sh(test.sh\u4e3a\u81ea\u5df1\u7684\u811a\u672c)<\/p>\n

\u7279\u5f81\uff1a\u5728\u7528MobaXterm\u7b49\u8fdc\u7a0b\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u5de5\u5177linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8<\/strong>\uff0c\u8054\u63a5\u8fdc\u7a0b\u670d\u52a1\u5668\u65f6\u7ea2\u65d7linux5.0\uff0c\u811a\u672c\u4e5f\u4f1a\u8ddf\u968f\u4ed6\u81ea\u542f\u52a8\u3002<\/p>\n

server2003\u5982\u4f55\u5c06\u7a0b\u5e8f\u8bbe\u7f6e\u6210\u5f00\u673a\u542f\u52a8_\u5982\u4f55\u628a\u67d0\u4e2a\u7a0b\u5e8f\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8_linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n

\u64cd\u4f5c\uff1a<\/p>\n

\n

1 \u6253\u5f00 \/etc\/rc.d\/rc.local \u6587\u4ef6\uff1a\nsudo vim \/etc\/rc.d\/rc.local\n2 \u5728\u6587\u4ef6\u7684\u672b\u5c3e\u6dfb\u52a0\u60a8\u8981\u542f\u52a8\u7684\u8fdb\u7a0b\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a\n\/path\/to\/your\/process &\n\u8bf7\u5c06 \/path\/to\/your\/process \u66ff\u6362\u4e3a\u60a8\u8981\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u5b9e\u9645\u8def\u5f84\u3002\n3 \u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002\u9000\u51fa\u7684\u65b9\u6cd5\u6253\u4e00\u4e2a\u5192\u53f7\uff1a\uff0c\u518d\u6253\u4e00\u4e2awq\u6309\u56de\u8f66\u5c31\u62a5\u9519\u4e86\u9000\u51fa\u8fd9\u4e2a\u6587\u4ef6\u4e86\u3002\n4 \u6388\u4e88 \/etc\/rc.d\/rc.local \u6587\u4ef6\u53ef\u6267\u884c\u6743\u9650\uff1a\nsudo chmod +x \/etc\/rc.d\/rc.local\n\u73b0\u5728\uff0c\u6bcf\u6b21\u7cfb\u7edf\u542f\u52a8\u65f6\uff0c\/etc\/rc.d\/rc.local \u6587\u4ef6\u4e2d\u6dfb\u52a0\u7684\u547d\u4ee4\u90fd\u4f1a\u81ea\u52a8\u8fd0\u884c\uff0c\u60a8\u7684\u8fdb\u7a0b\u4e5f\u5e94\u8be5\u4f1a\u81ea\u52a8\u542f\u52a8\u3002\n<\/code><\/pre>\n<\/p>\n

2\/etc\/profile.d\/\u65b9\u5f0f<\/p>\n

\n

1\u521b\u5efa \/etc\/profile.d\/ \u76ee\u5f55\uff08\u5982\u679c\u8be5\u76ee\u5f55\u4e0d\u5b58\u5728\uff09\uff1a(\u5982\u679c\u5df2\u7ecf\u5b58\u5728\u8fd9\u4e2a\u76ee\u5f55\u6587\u4ef6\u5c31\u4e0d\u8981\u521b\u5efa\u4e86\u76f4\u63a5\u8df3\u8fc7\u8fd9\u4e00\u6b65)\nsudo mkdir -p \/etc\/profile.d\/\n2 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u811a\u672c\u6587\u4ef6\uff1a\nsudo vim \/etc\/profile.d\/my_startup.sh\n3 \u5728\u8be5\u6587\u4ef6\u4e2d\u6dfb\u52a0\u60a8\u8981\u542f\u52a8\u7684\u8fdb\u7a0b\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a\n\/path\/to\/your\/process &\n\u8bf7\u5c06 \/path\/to\/your\/process \u66ff\u6362\u4e3a\u60a8\u8981\u542f\u52a8\u7684\u8fdb\u7a0b\u7684\u5b9e\u9645\u8def\u5f84\u3002\n4 \u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668    \u8f93\u5165\uff1a + wq \u56de\u8f66\n5\u6388\u4e88\u811a\u672c\u6587\u4ef6\u53ef\u6267\u884c\u6743\u9650\uff1a\nsudo chmod +x \/etc\/profile.d\/my_startup.sh\n\u73b0\u5728\uff0c\u6bcf\u6b21\u7528\u6237\u767b\u5f55\u65f6\uff0c \/etc\/profile.d\/my_startup.sh \u811a\u672c\u4e2d\u6dfb\u52a0\u7684\u547d\u4ee4\u90fd\u4f1a\u81ea\u52a8\u8fd0\u884c\uff0c\u60a8\u7684\u8fdb\u7a0b\u4e5f\u5e94\u8be5\u4f1a\u81ea\u52a8\u542f\u52a8\u3002\n<\/code><\/pre>\n<\/p>\n

linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8_server2003\u5982\u4f55\u5c06\u7a0b\u5e8f\u8bbe\u7f6e\u6210\u5f00\u673a\u542f\u52a8_\u5982\u4f55\u628a\u67d0\u4e2a\u7a0b\u5e8f\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8<\/p>\n

3\u53ef\u4ee5\u4f7f\u7528crontab<\/a>\u5de5\u5177<\/p>\n

\u53ef\u4ee5\u4f7f\u7528crontab\u5de5\u5177\u6765\u8bbe\u7f6e\u5728\u7cfb\u7edf<\/a>\u542f\u52a8\u65f6\u624b\u52a8\u542f\u52a8\u8fdb\u7a0b,crontab\u662f\u4e00\u4e2a\u7528\u4e8e\u8bbe\u7f6e\u548c\u7ba1\u7406\u5468\u671f\u6027\u4efb\u52a1\u7684\u5de5\u5177linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8<\/strong>\uff0c\u53ef\u4ee5\u8ba9\u60a8\u8bbe\u7f6e\u5b9a\u65f6\u8fd0\u884c\u7684\u547d\u4ee4<\/a>\u6216\u811a\u672c\u3002<\/p>\n

linux \u7a0b\u5e8f\u5f00\u673a\u81ea\u542f\u52a8_\u5982\u4f55\u628a\u67d0\u4e2a\u7a0b\u5e8f\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8_server2003\u5982\u4f55\u5c06\u7a0b\u5e8f\u8bbe\u7f6e\u6210\u5f00\u673a\u542f\u52a8<\/p>\n

\u800c\u4e14\u6211\u6ca1\u7528\u8fc7\uff0c\u7531\u4e8e\u81ea\u5df1\u611f\u89c9\u6709\u70b9\u9ebb\u70e6\uff0c\u800c\u4e14\u5bf9\u4e8e\u5b9a\u65f6\u542f\u52a8\u8fd8\u662f\u5f88\u4e0d\u9519\u7684\u3002<\/p>\n

Windows\u7684\u81ea\u542f\u52a8\u524d\u9762\u7528\u5230\u518d\u5f04\uff0c\u591a\u8c22\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\/etc\/rc.d\/rc.\u628a\u81ea\u542f\u52a8\u811a\u672c\u653e\u5728\/etc\/profile.\u4e3a\u4e86\u4fdd\u8bc1\u4e00\u5b9a\u80fd\u6267\u884c\uff0c\u6700\u597d\u518d\u52a0\u4e2a\u8d4b\u6743\u64cd\u4f5c\/etc\/profile.d\/test01.sh\u4e3a\u81ea\u5df1\u7684\u811a\u672c)\u7279\u70b9\uff1a\u5728\u7528MobaXterm\u7b49\u8fdc\u7a0b\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u5de5\u5177\uff0c\u8fde\u63a5\u8fdc\u7a0b\u670d\u52a1\u5668\u65f6\uff0c\u811a\u672c\u4e5f\u4f1a\u8ddf\u7740\u4ed6\u81ea\u542f\u52a8\u3002\/etc\/profile.\u662f\u4e00\u4e2a\u7528\u4e8e\u8bbe\u7f6e\u548c\u7ba1\u7406\u5468\u671f\u6027\u4efb\u52a1\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u8ba9\u60a8\u8bbe\u7f6e\u5b9a\u65f6\u8fd0\u884c\u7684\u547d\u4ee4\u6216\u811a\u672c\u3002Windows\u7684\u81ea\u542f\u52a8\u540e\u9762\u7528\u5230\u518d\u5f04\uff0c\u8c22\u8c22\u3002<\/p>\n","protected":false},"author":1,"featured_media":270762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-270761","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/270761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=270761"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/270761\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/270762"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=270761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=270761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=270761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}