Skip to content

the command of getting CPU load is wrong #2

@Colbert337

Description

@Colbert337

this comand:

top -n1 | awk '/load average:/ {print $12}'

sometimes is wrong

because when we enter "top -n1",there are two sitiations:

top - 10:44:20 up **1 day,** 18:47, 2 users, load average: 0.30, 0.22, 0.19

and

top - 10:44:20 up **1:10,** 18:47, 2 users, load average: 0.30, 0.22, 0.19

the up time is different,so “print $12” may get the wrong result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions