????linux?3???????????У?shutdown??halt??poweroff??init???????????У?reboot?????汾??????????Щ?????????????????????????????????????÷???
???????????????linux?±???????Щ???????
???????????
????1??halt ?????? 2??poweroff ?????? 3??shutdown -h now ??????(root??????) 4??shutdown -h 10 10??????????? ????????shutdown???????ù?????????????shutdown -c???????????
????????????
????1??reboot 2??shutdown -r now ????????(root??????) 3??shutdown -r 10 ??10???????????(root??????) 4??shutdown -r 20:35 ??????20:35???????(root??????) ????????shutdown??????????????????????shutdown -c???????????
??????????????????linux????Щ?????????????????????????÷?
????1.shutdown ???????????
????????shutdown???????????????????????????????????-h??-r?????????????????????????linux??????????root??????????????????????????????????????????????????????????????????????????????????????root???ɡ?shutdown??й????????????init?????????????м????????????????????????????????м????????????????????????init?????????м????????й??????????????????????????????????????????????root????
????2.???????shutdown???????????????????
???????????Щ????????????????????????linux?????????Σ???????linux??windows????????????????????????????????????????????????????????????????????????е????л???????豸???????????????shutdown??????????????????е????????????????????login???????????μ?????????????????????????????????????????????????п???????????????????н????process?????????????????????signal?????????
????shutdown??????????????????signal????init???????????? runlevel??runlevel 0 ???????????halt????runlevel 6 ?????????????reboot???????? runlevel 1?????????????????????????????е????????????????????-h????-r??????shutdown???????????????halt???????????????reboot??????????????Щ???????????????????/etc/inittab??????Щrunlevels?????????
????shutdown ???????:
????[-t] ????????runlevel????????init?????????? [-r] ??????????? [-k] ??????????????????????????λ??????login???? [-h] ???????????halt???? [-n] ????init????????????????????????????????????????????????????????????????????? [-c] cancel current process???????????е???????????????????????????????????????????????????????????????????????λ?????? [-f] ?????????????reboot???????fsck?? [-F] ?????????????reboot??????fsck?? [-time] ?趨?????shutdown???????? ???? ???? 2.halt ??????????
??????halt?????????????????????shutdown -h??halt ???????????y???????sync???????????д???????????????
????halt ???????:
????[-n] ???sync???????????????fsck????????????????????????汾??????顲superblock?????????????????顣 [-w] ????????????????????????дwtmp??/var/log/wtmp??????? [-d] ??дwtmp???????????????[-n]?С??? [-f] ??е???shutdown?????????????? [-i] ???????????????????е???????? [-p] ???????????????????poweroff??
????3.poweroff ???????????
????????poweroff???????????halt???????????????÷??? halt ??????????????
????4.init
????init?????н?????????????Linux???????в??????????????????????????1?????????TERM????init????????е??????????????????shutdown ?????????????init??????8?????м???(runlevel)??init 0??????init 1??????
????5.reboot ????????
????reboot?????????????halt????????????????????????????halt???????????????halt?????