Uptime command:
-* Use the uptime command to get host run time and query Linux system load information. The information is displayed in the following order: Now time, the system has elapsed time, the current number of landing users, the system in the past 1 minutes, 5 minutes and 15 minutes of the average load. *
ubuntu@ubuntu:~$ Uptime
17:42:05 up 3 days, 7:58, 6 users, load average:0.11, 0.10, 0.11
17:42:05//System Current time
Up to 3 days, 7:58//host has run time, the greater the time, indicating the stability of the host
6 user//connection number, total number of connections instead of number of users
Load average*//System average load, statistic last 1, 5, 15 min system average load, system average load is the average number of processes running in a queue at a specific time interval.
The solution method thought:
Record the Sys_pid_before,reboot_before before the test, and record the sys_pid_after,reboot_after after the test.
If [$ ((reboot_after-reboot_before))-GT 10] | | [$sys _pid_before-ne $sys _pid_after] is considered a soft reboot of Android
If [$ ((reboot_after-reboot_before))-GT 10] is established, it is considered an android hard reboot
' SYS_PID_AFTER=ADB shell PS System_server|awk ' nr==2{print $} '
date= ' adb shell date +%s|grep-o ' ^[0-9].*[0-9] '
Uptime= ' adb shell cat/proc/uptime|awk-f ' {print $} '
reboot_after= ' Expr date−uptime '
Sys_pid_before= $sys _pid_after
Reboot_before= $reboot _after
If [$ ((reboot_after-reboot_before))-GT 10] | | [$sys _pid_before-ne $sys _pid_after]; Then
Echo ==========system_server reboot==========
If [$ (reboot_after-reboot_before))-gt];then
Echo ==========kernel panics==========
Fi
Hi.