法一,如果是启动过程,可以检测到/tmp/sys_booting文件
法二,检测系统的开机时间:cat /proc/uptime | awk {print int($0)}, 一般开机时间是几十秒,从而可以判断开机多长时间了。
本文介绍了一种通过检测 /tmp/sys_booting 文件来判断系统是否处于启动过程的方法,以及利用 cat/proc/uptime 和 awk 命令计算系统开机时间的技巧。
法一,如果是启动过程,可以检测到/tmp/sys_booting文件
法二,检测系统的开机时间:cat /proc/uptime | awk {print int($0)}, 一般开机时间是几十秒,从而可以判断开机多长时间了。

被折叠的 条评论
为什么被折叠?