{"id":89952,"date":"2024-02-29T13:40:22","date_gmt":"2024-02-29T05:40:22","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=89952"},"modified":"2024-02-29T13:40:22","modified_gmt":"2024-02-29T05:40:22","slug":"linux-shutdown-start","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-shutdown-start.html","title":{"rendered":"linux \u7cfb\u7edf\u5982\u4f55\u81ea\u52a8\u5173\u673a\u548c\u5f00\u673a"},"content":{"rendered":"
\u4e0d\u8981\u6210\u4e3a\u4e00\u4e2a\u7535\u80fd\u6d6a\u8d39\u8005\u3002\u5982\u679c\u4f60\u7684\u7535\u8111\u4e0d\u9700\u8981\u5f00\u673a\u5c31\u8bf7\u628a\u5b83\u4eec\u5173\u673a\u3002\u51fa\u4e8e\u65b9\u4fbf\u548c\u8ba1\u7b97\u673a\u5b85\u7684\u8003\u8651\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u4f60\u7684 Linux \u8ba1\u7b97\u673a\u5b9e\u73b0\u81ea\u52a8\u5524\u9192\u548c\u5173\u95ed\u3002<\/p>\n
\u6709\u65f6\u5019\u6709\u4e9b\u7535\u8111\u9700\u8981\u4e00\u76f4\u5904\u5728\u5f00\u673a\u72b6\u6001\uff0c\u5728\u4e0d\u8d85\u8fc7\u7535\u8111\u8fd0\u884c\u65f6\u95f4\u7684\u9650\u5236\u4e0b\u8fd9\u79cd\u60c5\u51b5\u662f\u88ab\u5141\u8bb8\u7684\u3002\u6709\u4e9b\u4eba\u4e3a\u4ed6\u4eec\u7684\u8ba1\u7b97\u673a\u53ef\u4ee5\u957f\u65f6\u95f4\u7684\u6b63\u5e38\u8fd0\u884c\u800c\u611f\u5230\u81ea\u8c6a\uff0c\u4e14\u73b0\u5728\u6211\u4eec\u6709\u5185\u6838\u70ed\u8865\u4e01\u80fd\u591f\u5b9e\u73b0\u53ea\u6709\u5728\u786c\u4ef6\u53d1\u751f\u6545\u969c\u65f6\u624d\u9700\u8981\u673a\u5668\u5173\u673a\u3002\u6211\u8ba4\u4e3a\u6bd4\u8f83\u5b9e\u9645\u53ef\u884c\u7684\u662f\uff0c\u50cf\u51cf\u5c11\u79fb\u52a8\u90e8\u4ef6\u78e8\u635f\u4e00\u6837\u8282\u7701\u7535\u80fd\uff0c\u4e14\u5728\u4e0d\u9700\u8981\u673a\u5668\u8fd0\u884c\u7684\u60c5\u51b5\u4e0b\u5c06\u5176\u5173\u673a\u3002\u6bd4\u5982\uff0c\u4f60\u53ef\u4ee5\u5728\u89c4\u5b9a\u7684\u65f6\u95f4\u5185\u5524\u9192\u5907\u4efd\u670d\u52a1\u5668\uff0c\u6267\u884c\u5907\u4efd\uff0c\u7136\u540e\u5173\u95ed\u5b83\u76f4\u5230\u5b83\u8981\u8fdb\u884c\u4e0b\u4e00\u6b21\u5907\u4efd\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u8bbe\u7f6e\u4f60\u7684\u4e92\u8054\u7f51\u7f51\u5173\u53ea\u5728\u7279\u5b9a\u7684\u65f6\u95f4\u8fd0\u884c\u3002\u4efb\u4f55\u4e0d\u9700\u8981\u4e00\u76f4\u8fd0\u884c\u7684\u4e1c\u897f\u90fd\u53ef\u4ee5\u5c06\u5176\u914d\u7f6e\u6210\u5728\u5176\u9700\u8981\u5de5\u4f5c\u7684\u65f6\u5019\u6253\u5f00\uff0c\u5f85\u5176\u5b8c\u6210\u5de5\u4f5c\u540e\u5c06\u5176\u5173\u95ed\u3002<\/p>\n
\u5bf9\u4e8e\u4e0d\u9700\u8981\u4e00\u76f4\u8fd0\u884c\u7684\u7535\u8111\uff0c\u4f7f\u7528 root \u7684 cron \u5b9a\u65f6\u4efb\u52a1\uff08\u5373 \/etc\/crontab<\/span>\uff09\u53ef\u4ee5\u53ef\u9760\u5730\u5173\u95ed\u7535\u8111\u3002\u8fd9\u4e2a\u4f8b\u5b50\u521b\u5efa\u4e00\u4e2a root \u5b9a\u65f6\u4efb\u52a1\u5b9e\u73b0\u6bcf\u5929\u665a\u4e0a 11 \u70b9 15 \u5206\u5b9a\u65f6\u5173\u673a\u3002<\/p>\n \u4ee5\u4e0b\u793a\u4f8b\u4ec5\u5728\u5468\u4e00\u81f3\u5468\u4e94\u8fd0\u884c\uff1a<\/p>\n \u60a8\u53ef\u4ee5\u4e3a\u4e0d\u540c\u7684\u65e5\u671f\u548c\u65f6\u95f4\u521b\u5efa\u591a\u4e2a cron \u4f5c\u4e1a\u3002 \u901a\u8fc7\u547d\u4ee4 man 5 crontab<\/span> \u53ef\u4ee5\u4e86\u89e3\u6240\u6709\u65f6\u95f4\u548c\u65e5\u671f\u7684\u5b57\u6bb5\u3002<\/p>\n \u4e00\u4e2a\u5feb\u901f\u3001\u5bb9\u6613\u7684\u65b9\u5f0f\u662f\uff0c\u4f7f\u7528 \/etc\/crontab<\/span> \u6587\u4ef6\u3002\u4f46\u8fd9\u6837\u4f60\u5fc5\u987b\u6307\u5b9a\u7528\u6237\uff1a<\/p>\n \u5b9e\u73b0\u81ea\u52a8\u5524\u9192\u662f\u4e00\u4ef6\u5f88\u9177\u7684\u4e8b\u60c5\uff1b\u6211\u5927\u591a\u6570 SUSE \uff08SUSE Linux\uff09\u7684\u540c\u4e8b\u90fd\u5728\u7ebd\u4f26\u5821\uff0c\u56e0\u6b64\uff0c\u56e0\u6b64\u4e3a\u4e86\u8ddf\u540c\u4e8b\u80fd\u6709\u51e0\u5c0f\u65f6\u4e00\u8d77\u5de5\u4f5c\u7684\u65f6\u95f4\uff0c\u6211\u4e0d\u5f97\u4e0d\u9700\u8981\u5728\u51cc\u6668\u4e94\u70b9\u8d77\u5e8a\u3002\u6211\u7684\u8ba1\u7b97\u673a\u65e9\u4e0a 5 \u70b9\u534a\u81ea\u52a8\u5f00\u59cb\u5de5\u4f5c\uff0c\u800c\u6211\u53ea\u9700\u8981\u5c06\u81ea\u5df1\u548c\u5496\u5561\u62d6\u5230\u6211\u7684\u684c\u5b50\u4e0a\u5c31\u53ef\u4ee5\u5f00\u59cb\u5de5\u4f5c\u4e86\u3002\u6309\u4e0b\u7535\u6e90\u6309\u94ae\u770b\u8d77\u6765\u597d\u50cf\u5e76\u4e0d\u662f\u4ec0\u4e48\u5927\u4e8b\uff0c\u4f46\u662f\u5728\u6bcf\u5929\u7684\u90a3\u4e2a\u65f6\u5019\u6bcf\u4ef6\u5c0f\u4e8b\u90fd\u4f1a\u53d8\u5f97\u5f88\u5927\u3002<\/p>\n \u5524\u9192 Linux \u8ba1\u7b97\u673a\u53ef\u80fd\u4e0d\u5982\u5173\u95ed\u5b83\u53ef\u9760\uff0c\u56e0\u6b64\u4f60\u53ef\u80fd\u9700\u8981\u5c1d\u8bd5\u4e0d\u540c\u7684\u529e\u6cd5\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fdc\u7a0b\u5524\u9192\uff08Wake-On-LAN\uff09\u3001RTC \u5524\u9192\u6216\u8005\u4e2a\u4eba\u7535\u8111\u7684 BIOS \u8bbe\u7f6e\u9884\u5b9a\u7684\u5524\u9192\u8fd9\u4e9b\u65b9\u5f0f\u3002\u8fd9\u4e9b\u65b9\u5f0f\u53ef\u884c\u7684\u539f\u56e0\u662f\uff0c\u5f53\u4f60\u5173\u95ed\u7535\u8111\u65f6\uff0c\u8fd9\u5e76\u4e0d\u662f\u771f\u6b63\u5173\u95ed\u4e86\u8ba1\u7b97\u673a\uff1b\u6b64\u65f6\u8ba1\u7b97\u673a\u5904\u5728\u6781\u4f4e\u529f\u8017\u72b6\u6001\u4e14\u8fd8\u53ef\u4ee5\u63a5\u53d7\u548c\u54cd\u5e94\u4fe1\u53f7\u3002\u53ea\u6709\u5728\u4f60\u62d4\u6389\u7535\u6e90\u5f00\u5173\u65f6\u5176\u624d\u5f7b\u5e95\u5173\u95ed\u3002<\/p>\n BIOS \u5524\u9192\u662f\u6700\u53ef\u9760\u7684\u3002\u6211\u7684\u7cfb\u7edf\u4e3b\u677f BIOS \u6709\u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684\u5524\u9192\u8c03\u5ea6\u7a0b\u5e8f (\u56fe 1)\u3002\u5bf9\u4f60\u6765\u8bf4\u4e5f\u662f\u4e00\u6837\u7684\u5bb9\u6613\u3002<\/p>\n <\/p>\n \u56fe 1\uff1a\u6211\u7684\u7cfb\u7edf BIOS \u6709\u4e2a\u6613\u7528\u7684\u5524\u9192\u5b9a\u65f6\u5668\u3002<\/em><\/p>\n \u8fdc\u7a0b\u5524\u9192\u662f\u4ec5\u6b21\u4e8e BIOS \u5524\u9192\u7684\u53c8\u4e00\u79cd\u53ef\u9760\u7684\u5524\u9192\u65b9\u6cd5\u3002\u8fd9\u9700\u8981\u4f60\u4ece\u7b2c\u4e8c\u53f0\u8ba1\u7b97\u673a\u53d1\u9001\u4fe1\u53f7\u5230\u6240\u8981\u6253\u5f00\u7684\u8ba1\u7b97\u673a\u3002\u53ef\u4ee5\u4f7f\u7528 Arduino \u6216\u6811\u8393\u6d3e# crontab -e -u root\r\n# m h dom mon dow command\r\n15 23 * * * \/sbin\/shutdown -h now\r\n<\/pre>\n
15 23 * * 1-5 \/sbin\/shutdown -h now\r\n<\/pre>\n
15 23 * * 1-5 root shutdown -h now\r\n<\/pre>\n