Linux命令学习总结:详解reboot命令
命令简介:
该命令用来重启Linux系统。相当于Windows系统中的restart命令。
命令语法:
/sbin/reboot[-n][-w][-d][-f][-i]
或
reboot[-n][-w][-d][-f][-i]
命令参数:
使用示例:
1:查看reboot命令的帮助信息
[root@DB-Server~]#reboot--help usage:reboot[-n][-w][-d][-f][-h][-i] -n:don'tsyncbeforehaltingthesystem -w:onlywriteawtmprebootrecordandexit. -d:don'twriteawtmprecord. -f:forcehalt/reboot,don'tcallshutdown. -h:putharddisksinstandbymode. -i:shutdownallnetworkinterfaces.
[root@DB-Server~]#manreboot
[root@DB-Server~]#manreboot HALT(8)LinuxSystemAdministrator鈥檚ManualHALT(8) NAME halt,reboot,poweroff-stopthesystem. SYNOPSIS /sbin/halt[-n][-w][-d][-f][-i][-p][-h] /sbin/reboot[-n][-w][-d][-f][-i] /sbin/poweroff[-n][-w][-d][-f][-i][-h] DESCRIPTION Haltnotesthatthesystemisbeingbroughtdowninthefile/var/log/wtmp,andtheneithertellsthekerneltohalt,rebootorpoweroffthesystem. Ifhaltorrebootiscalledwhenthesystemisnotinrunlevel0or6,inotherwordswhenit鈥檚runningnormally,shutdownwillbeinvokedinstead(with the-hor-rflag).Formoreinfoseetheshutdown(8)manpage. Therestofthismanpagedescribesthebehaviourinrunlevels0and6,thatiswhenthesystemsshutdownscriptsarebeingrun. OPTIONS -nDon鈥檛syncbeforerebootorhalt.Notethatthekernelandstoragedriversmaystillsync. -wDon鈥檛actuallyrebootorhaltbutonlywritethewtmprecord(inthe/var/log/wtmpfile). -dDon鈥檛writethewtmprecord.The-nflagimplies-d. -fForcehaltorreboot,don鈥檛callshutdown(8). -iShutdownallnetworkinterfacesjustbeforehaltorreboot. -hPutallharddrivesonthesysteminstandbymodejustbeforehaltorpoweroff. -pWhenhaltingthesystem,doapoweroff.Thisisthedefaultwhenhaltiscalledaspoweroff. DIAGNOSTICS Ifyou鈥檙enotthesuperuser,youwillgetthemessage鈥榤ustbesuperuser鈥?Usersloggedinlocallyontheconsolecancallhalt,reboot,andpoweroff withoutsupplyingtherootpassword,duetopam_console(8). NOTES Underoldersysvinitreleases,rebootandhaltshouldneverbecalleddirectly.Fromrelease2.74onhaltandrebootinvokeshutdown(8)ifthesystemis notinrunlevel0or6.Thismeansthatifhaltorrebootcannotfindoutthecurrentrunlevel(forexample,when/var/run/utmphasn鈥檛beeninitialized correctly)shutdownwillbecalled,whichmightnotbewhatyouwant.Usethe-fflagifyouwanttodoahardhaltorreboot. The-hflagputsallharddisksinstandbymodejustbeforehaltorpoweroff.RightnowthisisonlyimplementedforIDEdrives.Asideeffectofputting thedriveinstandbymodeisthatthewritecacheonthediskisflushed.ThisisimportantforIDEdrives,sincethekerneldoesn鈥檛flushthewrite-cache itselfbeforepoweroff. Thehaltprogramuses/proc/ide/hd*tofindallIDEdiskdevices,whichmeansthat/procneedstobemountedwhenhaltorpoweroffiscalledorthe-h switchwilldonothing. AUTHOR MiquelvanSmoorenburg,miquels@cistron.nl SEEALSO shutdown(8),init(8),pam_console(8) Nov6,2001HALT(8) (END)
2:强制重新开机,不调用shutdown指令的功能
[root@DB-Server~]#reboot-f
3:关闭网络设置之后再重新启动系统
[root@DB-Server~]#reboot-i Broadcastmessagefromroot(pts/1)(MonJul2811:31:282014): ThesystemisgoingdownforrebootNOW!
4:保存数据后再重新启动系统
[root@DB-Server~]#reboot-n Broadcastmessagefromroot(pts/1)(MonJul2811:33:572014): ThesystemisgoingdownforrebootNOW!
5:重新启动时不把数据写入记录文件/var/tmp/wtmp
[root@DB-Server~]#reboot-d Broadcastmessagefromroot(pts/2)(MonJul2811:23:262014): ThesystemisgoingdownforrebootNOW!
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。