{"id":240566,"date":"2022-04-28T09:55:31","date_gmt":"2022-04-28T01:55:31","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=240566"},"modified":"2022-04-19T11:52:26","modified_gmt":"2022-04-19T03:52:26","slug":"explain-linux-chkconfig","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/explain-linux-chkconfig.html","title":{"rendered":"\u8be6\u89e3Linux chkconfig\u547d\u4ee4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nchkconfig\u547d\u4ee4\u4e3b\u8981\u7528\u6765\u66f4\u65b0\uff08\u542f\u52a8\u6216\u505c\u6b62\uff09\u548c\u67e5\u8be2\u7cfb\u7edf\u670d\u52a1\u7684\u8fd0\u884c\u7ea7\u4fe1\u606f\u3002\u8c28\u8bb0chkconfig\u4e0d\u662f\u7acb\u5373\u81ea\u52a8\u7981\u6b62\u6216\u6fc0\u6d3b\u4e00\u4e2a\u670d\u52a1\uff0c\u5b83\u53ea\u662f\u7b80\u5355\u7684\u6539\u53d8\u4e86\u7b26\u53f7\u8fde\u63a5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4f7f\u7528\u8bed\u6cd5\uff1a<\/strong><\/div>\n

chkconfig [--add][--del][--list][\u7cfb\u7edf\u670d\u52a1] \u6216 chkconfig [--level <\u7b49\u7ea7\u4ee3\u53f7>][\u7cfb\u7edf\u670d\u52a1][on\/off\/reset]<\/p>\n

chkconfig\u5728\u6ca1\u6709\u53c2\u6570\u8fd0\u884c\u65f6\uff0c\u663e\u793a\u7528\u6cd5\u3002\u5982\u679c\u52a0\u4e0a\u670d\u52a1\u540d\uff0c\u90a3\u4e48\u5c31\u68c0\u67e5\u8fd9\u4e2a\u670d\u52a1\u662f\u5426\u5728\u5f53\u524d\u8fd0\u884c\u7ea7\u542f\u52a8\u3002\u5982\u679c\u662f\uff0c\u8fd4\u56detrue\uff0c\u5426\u5219\u8fd4\u56defalse\u3002\u5982\u679c\u5728\u670d\u52a1\u540d\u540e\u9762\u6307\u5b9a\u4e86on\uff0coff\u6216\u8005reset\uff0c\u90a3\u4e48chkconfi \u4f1a\u6539\u53d8\u6307\u5b9a\u670d\u52a1\u7684\u542f\u52a8\u4fe1\u606f\u3002on\u548coff\u5206\u522b\u6307\u670d\u52a1\u88ab\u542f\u52a8\u548c\u505c\u6b62\uff0creset\u6307\u91cd\u7f6e\u670d\u52a1\u7684\u542f\u52a8\u4fe1\u606f\uff0c\u65e0\u8bba\u6709\u95ee\u9898\u7684\u521d\u59cb\u5316\u811a\u672c\u6307\u5b9a\u4e86\u4ec0\u4e48\u3002on\u548coff\u5f00\u5173\uff0c\u7cfb\u7edf\u9ed8\u8ba4\u53ea\u5bf9\u8fd0\u884c\u7ea73\uff0c4\uff0c5\u6709\u6548\uff0c\u4f46\u662freset\u53ef\u4ee5\u5bf9\u6240\u6709\u8fd0\u884c\u7ea7\u6709\u6548\u3002<\/p>\n

\u53c2\u6570\u7528\u6cd5\uff1a<\/strong><\/div>\n

--add \u3000\u589e\u52a0\u6240\u6307\u5b9a\u7684\u7cfb\u7edf\u670d\u52a1\uff0c\u8ba9chkconfig\u6307\u4ee4\u5f97\u4ee5\u7ba1\u7406\u5b83\uff0c\u5e76\u540c\u65f6\u5728\u7cfb\u7edf\u542f\u52a8\u7684\u53d9\u8ff0\u6587\u4ef6\u5185\u589e\u52a0\u76f8\u5173\u6570\u636e\u3002
\n --del \u3000\u5220\u9664\u6240\u6307\u5b9a\u7684\u7cfb\u7edf\u670d\u52a1\uff0c\u4e0d\u518d\u7531chkconfig\u6307\u4ee4\u7ba1\u7406\uff0c\u5e76\u540c\u65f6\u5728\u7cfb\u7edf\u542f\u52a8\u7684\u53d9\u8ff0\u6587\u4ef6\u5185\u5220\u9664\u76f8\u5173\u6570\u636e\u3002
\n --level<\u7b49\u7ea7\u4ee3\u53f7> \u3000\u6307\u5b9a\u8bfb\u7cfb\u7edf\u670d\u52a1\u8981\u5728\u54ea\u4e00\u4e2a\u6267\u884c\u7b49\u7ea7\u4e2d\u5f00\u542f\u6216\u5173\u6bd5\u3002
\n \u7b49\u7ea70\u8868\u793a\uff1a\u8868\u793a\u5173\u673a
\n \u7b49\u7ea71\u8868\u793a\uff1a\u5355\u7528\u6237\u6a21\u5f0f
\n \u7b49\u7ea72\u8868\u793a\uff1a\u65e0\u7f51\u7edc\u8fde\u63a5\u7684\u591a\u7528\u6237\u547d\u4ee4\u884c\u6a21\u5f0f
\n \u7b49\u7ea73\u8868\u793a\uff1a\u6709\u7f51\u7edc\u8fde\u63a5\u7684\u591a\u7528\u6237\u547d\u4ee4\u884c\u6a21\u5f0f
\n \u7b49\u7ea74\u8868\u793a\uff1a\u4e0d\u53ef\u7528
\n \u7b49\u7ea75\u8868\u793a\uff1a\u5e26\u56fe\u5f62\u754c\u9762\u7684\u591a\u7528\u6237\u6a21\u5f0f
\n \u7b49\u7ea76\u8868\u793a\uff1a\u91cd\u65b0\u542f\u52a8
\n \u9700\u8981\u8bf4\u660e\u7684\u662f\uff0clevel\u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u8981\u67e5\u770b\u7684\u8fd0\u884c\u7ea7\u800c\u4e0d\u4e00\u5b9a\u662f\u5f53\u524d\u8fd0\u884c\u7ea7\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u8fd0\u884c\u7ea7\uff0c\u53ea\u80fd\u6709\u4e00\u4e2a\u542f\u52a8\u811a\u672c\u6216\u8005\u505c\u6b62\u811a\u672c\u3002\u5f53\u5207\u6362\u8fd0\u884c\u7ea7\u65f6\uff0cinit\u4e0d\u4f1a\u91cd\u65b0\u542f\u52a8\u5df2\u7ecf\u542f\u52a8\u7684\u670d\u52a1\uff0c\u4e5f\u4e0d\u4f1a\u518d\u6b21\u53bb\u505c\u6b62\u5df2\u7ecf\u505c\u6b62\u7684\u670d\u52a1\u3002<\/p>\n

chkconfig --list [name]\uff1a\u663e\u793a\u6240\u6709\u8fd0\u884c\u7ea7\u7cfb\u7edf\u670d\u52a1\u7684\u8fd0\u884c\u72b6\u6001\u4fe1\u606f\uff08on\u6216off\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86name\uff0c\u90a3\u4e48\u53ea\u663e\u793a\u6307\u5b9a\u7684\u670d\u52a1\u5728\u4e0d\u540c\u8fd0\u884c\u7ea7\u7684\u72b6\u6001\u3002
\n chkconfig --add name\uff1a\u589e\u52a0\u4e00\u9879\u65b0\u7684\u670d\u52a1\u3002chkconfig\u786e\u4fdd\u6bcf\u4e2a\u8fd0\u884c\u7ea7\u6709\u4e00\u9879\u542f\u52a8(S)\u6216\u8005\u6740\u6b7b(K)\u5165\u53e3\u3002\u5982\u6709\u7f3a\u5c11\uff0c\u5219\u4f1a\u4ece\u7f3a\u7701\u7684init\u811a\u672c\u81ea\u52a8\u5efa\u7acb\u3002
\n chkconfig --del name\uff1a\u5220\u9664\u670d\u52a1\uff0c\u5e76\u628a\u76f8\u5173\u7b26\u53f7\u8fde\u63a5\u4ece\/etc\/rc[0-6].d\u5220\u9664\u3002
\n chkconfig [--level levels] name\uff1a\u8bbe\u7f6e\u67d0\u4e00\u670d\u52a1\u5728\u6307\u5b9a\u7684\u8fd0\u884c\u7ea7\u662f\u88ab\u542f\u52a8\uff0c\u505c\u6b62\u8fd8\u662f\u91cd\u7f6e\u3002<\/p>\n

\u8fd0\u884c\u7ea7\u6587\u4ef6\uff1a<\/strong><\/div>\n

\u6bcf\u4e2a\u88abchkconfig\u7ba1\u7406\u7684\u670d\u52a1\u9700\u8981\u5728\u5bf9\u5e94\u7684init.d\u4e0b\u7684\u811a\u672c\u52a0\u4e0a\u4e24\u884c\u6216\u8005\u66f4\u591a\u884c\u7684\u6ce8\u91ca\u3002\u7b2c\u4e00\u884c\u544a\u8bc9chkconfig\u7f3a\u7701\u542f\u52a8\u7684\u8fd0\u884c\u7ea7\u4ee5\u53ca\u542f\u52a8\u548c\u505c\u6b62\u7684\u4f18\u5148\u7ea7\u3002\u5982\u679c\u67d0\u670d\u52a1\u7f3a\u7701\u4e0d\u5728\u4efb\u4f55\u8fd0\u884c\u7ea7\u542f\u52a8\uff0c\u90a3\u4e48\u4f7f\u7528 - \u4ee3\u66ff\u8fd0\u884c\u7ea7\u3002\u7b2c\u4e8c\u884c\u5bf9\u670d\u52a1\u8fdb\u884c\u63cf\u8ff0\uff0c\u53ef\u4ee5\u7528\\ \u8de8\u884c\u6ce8\u91ca\u3002
\n\u4f8b\u5982\uff0crandom.init\u5305\u542b\u4e09\u884c\uff1a<\/p>\n

# chkconfig: 2345 20 80\r\n# description: Saves and restores system entropy pool for \\\r\n# higher quality random number generation.<\/pre>\n
\u4f7f\u7528\u8303\u4f8b\uff1a<\/strong><\/div>\n

chkconfig --list #\u5217\u51fa\u6240\u6709\u7684\u7cfb\u7edf\u670d\u52a1
\nchkconfig --add httpd #\u589e\u52a0httpd\u670d\u52a1
\nchkconfig --del httpd #\u5220\u9664httpd\u670d\u52a1
\nchkconfig --level httpd 2345 on #\u8bbe\u7f6ehttpd\u5728\u8fd0\u884c\u7ea7\u522b\u4e3a2\u30013\u30014\u30015\u7684\u60c5\u51b5\u4e0b\u90fd\u662fon\uff08\u5f00\u542f\uff09\u7684\u72b6\u6001
\nchkconfig --list #\u5217\u51fa\u7cfb\u7edf\u6240\u6709\u7684\u670d\u52a1\u542f\u52a8\u60c5\u51b5
\nchkconfig --list mysqld #\u5217\u51famysqld\u670d\u52a1\u8bbe\u7f6e\u60c5\u51b5
\nchkconfig --level 35 mysqld on #\u8bbe\u5b9amysqld\u5728\u7b49\u7ea73\u548c5\u4e3a\u5f00\u673a\u8fd0\u884c\u670d\u52a1\uff0c--level 35\u8868\u793a\u64cd\u4f5c\u53ea\u5728\u7b49\u7ea73\u548c5\u6267\u884c\uff0con\u8868\u793a\u542f\u52a8\uff0coff\u8868\u793a\u5173\u95ed
\nchkconfig mysqld on #\u8bbe\u5b9amysqld\u5728\u5404\u7b49\u7ea7\u4e3aon\uff0c\u201c\u5404\u7b49\u7ea7\u201d\u5305\u62ec2\u30013\u30014\u30015\u7b49\u7ea7<\/p>\n

\u5982\u4f55\u589e\u52a0\u4e00\u4e2a\u670d\u52a1\uff1a<\/strong><\/div>\n

1.\u670d\u52a1\u811a\u672c\u5fc5\u987b\u5b58\u653e\u5728\/etc\/ini.d\/\u76ee\u5f55\u4e0b\uff1b<\/p>\n

2.chkconfig --add servicename<\/p>\n

\u5728chkconfig\u5de5\u5177\u670d\u52a1\u5217\u8868\u4e2d\u589e\u52a0\u6b64\u670d\u52a1\uff0c\u6b64\u65f6\u670d\u52a1\u4f1a\u88ab\u5728\/etc\/rc.d\/rcN.d\u4e2d\u8d4b\u4e88K\/S\u5165\u53e3\u4e86\uff1b<\/p>\n

3.chkconfig --level 35 mysqld on<\/p>\n

\u4fee\u6539\u670d\u52a1\u7684\u9ed8\u8ba4\u542f\u52a8\u7b49\u7ea7\u3002<\/p>\n

4.\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n

chkconfig mysql on\r\nchkconfig --list | grep mysql<\/pre>\n

\"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

chkconfig [–add][–del][–list][\u7cfb\u7edf\u670d\u52a1] \u6216 chkconfig [–l […]<\/p>\n","protected":false},"author":310,"featured_media":240574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-240566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/240566","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\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=240566"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/240566\/revisions"}],"predecessor-version":[{"id":240821,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/240566\/revisions\/240821"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/240574"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=240566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=240566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=240566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}