\u547d\u4ee4<\/a>\u4f5c\u4e3a\u4e00\u4e2a\u53c2\u6570\u4f20\u9012\u7ea7su<\/p>\n\u65b9\u6848\u4e8c\uff1a<\/p>\n
1.init.d\u76ee\u5f55\u4e0b\u90fd\u4e3a\u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u5979\u4eec\u6216\u8bb8\u662f\u670d\u52a1\u811a\u672c\uff0c\u4f9d\u7167\u4e00\u5b9a\u683c\u5f0f\u7f16\u64b0\uff0cLinux\u5728\u542f\u52a8\u65f6\u4f1a\u624b\u52a8\u6267\u884c\uff0c\u7c7b\u4f3cWindows\u4e0b\u7684\u670d\u52a1<\/p>\n
2.\u7528root\u8d26\u53f7\u767b\u9646\uff0cvi\/etc\/rc.d\/init.d\/mystart\uff0c\u8ffd\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n
#!\/bin\/bash<\/p>\n
#chkconfig:23458005--\u6307\u5b9a\u5728\u54ea\u51e0\u4e2a\u7ea7\u522b\u6267\u884c\uff0c0\u901a\u5e38\u6307\u6b7b\u673a\uff0c<\/p>\n
6\u6307\u7684\u662f\u91cd\u542f\uff0c\u5176\u4ed6\u4e3a\u6b63\u5e38\u542f\u52a8\u300280\u4e3a\u542f\u52a8\u7684\u4f18\u5148\u7ea7\uff0c05\u4e3a\u5173\u6389\u7684\u4f18\u5148\u673a<\/p>\n
#description:mystartservice<\/p>\n
RETVAL=0<\/p>\n
start(){--\u542f\u52a8\u670d\u52a1\u7684\u5165\u53e3\u51fd\u6570<\/p>\n
echo-n\"mystartserive...\"<\/p>\n
cd\/home\/test1<\/p>\n
sutest1-c\"python\/home\/test1\/test.py\"<\/p>\n
}<\/p>\n
stop(){--\u5173\u6389\u670d\u52a1\u7684\u5165\u53e3\u51fd\u6570<\/p>\n
echo\"mystartserviceisstoped...\"<\/p>\n
}<\/p>\n
case{GetProperty(Content)}in--\u4f7f\u7528case\uff0c\u53ef\u4ee5\u8fdb\u884c\u4ea4\u4e92\u5f0f\u64cd\u4f5c<\/p>\n
start)<\/p>\n
start<\/p>\n
;;<\/p>\n
stop)<\/p>\n
stop<\/p>\n
;;<\/p>\n
esac<\/p>\n
exit$RETVAL<\/p>\n
3.\u8fd0\u884cchmod+r\/etc\/rc.d\/init.d\/mystart\uff0c\u4f7f\u4e4b\u53ef\u76f4\u63a5\u6267\u884c<\/p>\n
4.\u8fd0\u884cchkconfig\u2014\u2014addmystart\uff0c\u628a\u8be5\u670d\u52a1\u6dfb\u52a0\u5230\u914d\u7f6e\u5f53\u4e2d<\/p>\n
5.\u8fd0\u884cchkconfig\u2014\u2014listmystart\uff0c\u53ef\u4ee5\u67e5\u770b\u8be5\u670d\u52a1\u8fdb\u7a0b\u7684\u72b6\u6001<\/p>\n
\u603b\u7ed3\uff1a<\/p>\n
\u4e24\u79cd\u65b9\u6848\u7684\u7684\u6838\u5fc3\u90fd\u662f\u5207\u6362\u7528\u6237\u5230test1\uff0c\u4e4b\u540e\u6267\u884c\u547d\u4ee4\u542f\u52a8Python\u7a0b\u5e8f\uff0c\u5f04\u6210\u670d\u52a1\u7684\u7528\u5904\u662f\u53ef\u4ee5\u5b9a\u4e49\u591a\u4e2a\u4ea4\u4e92\u547d\u4ee4\uff0c\u4f8b\u5982\uff1astart\uff0cstop\uff0crestart\uff0creset\u2026\u2026\uff0c\u5728\u670d\u52a1\u8fd0\u884c\u7684\u8fc7\u7a0b\u4e2d\u8fd8\u53ef\u4ee5\u505a\u76f8\u5e94\u64cd\u4f5c\u3002\u6700\u5f00\u59cb\u7684\u65f6\u4faf\uff0c\u6211\u6839\u636e\u901a\u5e38\u7684\u601d\u8def\u5199\u4e86\u5982\u4e0b\u811a\u672c\uff0c\u5374\u600e\u6837\u4e5f\u6267\u884c\u4e0d\u4e86\uff1a<\/p>\n
sutest1--\u5207\u6362\u5230test1\u7528\u6237<\/p>\n
cd\/home\/test1--\u5207\u6362\u5230\u6839\u76ee\u5f55<\/p>\n
pythontest.py--\u6267\u884cpython\u7a0b\u5e8f<\/p>\n
exit--\u9000\u51fatest1\u8d26\u53f7<\/p>\n
\u770b\u4e0a\u53bb\u4f3c\u4e4e\u4e00\u5207\u90fd\u6ca1\u9519\uff0c\u53ef\u662f\u53d1\u89c9\u53ea\u8fd0\u884c\u4e86\u7b2c\u4e00\u884c\u7684\u547d\u4ee4\uff0c\u65c1\u8fb9\u7684\u90fd\u6ca1\u6709\u8fd0\u884c\uff0c\u76f4\u81f3\u9000\u51fatest1\u7528\u6237\u540e\u624d\u53d1\u89c9\u4f3c\u4e4e\u6267\u884c\u5b8c\u6bd5\u3002\u5256\u6790\u7f18\u7531linux\u7cfb\u7edf\u4ecb\u7ecd\uff0c\u662f\u7531\u4e8eLinux\u542f\u52a8\u7684\u65f6\u4faf\u662f\u5728root\u8d26\u53f7\u4e0b\uff0c\u6267\u884csutest1\u7b49\u4e8e\u6253\u5f00\u4e86\u4e00\u4e2a\u65b0\u7684shell\u811a\u672clinux \u8bba\u575b\uff0c\u56e0\u800c\u4e0b\u8fb9\u7684\u4ee3\u7801\u90fd\u5728\u7b49\u7740\u65b0\u7684Shell\u811a\u672c\u7ed3\u675f\u5c31\u80fd\u8fd0\u884c\uff0c\u5c31\u50cf\u5728\u4e3b\u7a0b\u5e8f\u91cc\u8c03\u7528\u4e86\u4e00\u4e2a\u5b50\u7a0b\u5e8flinux\u81ea\u542f\u52a8u\u76d8\u811a\u672c<\/strong>\uff0c\u800c\u5b50\u7a0b\u5e8f\u662f\u4e2a\u6b7b\u5faa\u73af\uff0c\u4e00\u4e0b\u4e0b\u6765\u6765\u7ed3\u679c\u4e0b\u8fb9\u7684\u8981\u7b49\u6b7b\u4e86\u3002\u6653\u5f97\u4e86\u53d1\u751f\u7684\u8bf1\u56e0\uff0c\u8fd9\u4e48\u89e3\u51b3\u7684\u529e\u6cd5\u5c31\u76f8\u5bf9\u7b80\u5355\u4e86\uff0c\u5c31\u662f\u5728\u6267\u884c\u4e0a\u8ff0\u811a\u672c\u7a0b\u5e8f\u65f6\uff0c\u4e0d\u8981\u79bb\u5f00\u672c\u8eab\u7684Shell.\u6211\u4eec\u53ef\u4ee5\u628a\u6267\u884c\u547d\u4ee4\u505a\u4e3asu\u7684\u4e00\u4e2a\u53c2\u6570\u4f20\u9012\u8fdb\u53bb\uff0c\u7531\u4e8e\u6ca1\u6709\u6d89\u53ca\u5230\u6253\u5f00\u65b0\u7684Shell\uff0c\u56e0\u800c\u53ef\u4ee5\u6b63\u5e38\u6267\u884c\u4f60\u671f\u671b\u7684\u811a\u672c\u7a0b\u5e8f\uff0c\u987a\u5229\u5b9e\u73b0\u5f00\u673a\u624b\u52a8\u542f\u52a8\u6307\u5b9a\u7684\u811a\u672c\u7a0b\u5e8f<\/p>\n","protected":false},"excerpt":{"rendered":"\u5b9e\u73b0\u76ee\u6807\uff1a\u5728Linux\u542f\u52a8\u65f6\uff0c\u81ea\u52a8\u8fd0\u884c\u4f4d\u4e8e\u666e\u901a\u7528\u6237test1\u6839\u76ee\u5f55\u4e0b\u7684\u811a\u672c\u7a0b\u5e8ftest.Linux\u5728\u542f\u52a8\u65f6\uff0c\u4f1a\u81ea\u52a8\u6267\u884c\/etc\/rc.d\u76ee\u5f55\u4e0b\u7684\u521d\u59cb\u5316\u7a0b\u5e8f\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u628a\u542f\u52a8\u4efb\u52a1\u653e\u5230\u8be5\u76ee\u5f55\u4e0b\uff0c\u6709\u4e24\u79cd\u529e\u6cd5\uff1alocal\u662f\u5728\u5b8c\u6210\u6240\u6709\u521d\u59cb\u5316\u4e4b\u540e\u6267\u884c\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u628a\u542f\u52a8\u811a\u672c\u5199\u5230\u91cc\u9762local\u7f16\u8f91\u6587\u4ef6\uff0c\u5728\u6700\u540e\u52a0\u5165\u4e24\u884c\u9700\u8981\u6267\u884c\u7684\u811a\u672c\u7a0b\u5e8f\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-275533","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/275533","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=275533"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/275533\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=275533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=275533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=275533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}