?
Solved

load average command

Posted on 2008-11-13
1
Medium Priority
?
2,070 Views
Last Modified: 2013-11-22
hello there,
im running this in linux server but i cant run it on freebsd.
linux command doesnt work on freebsd so i have to use sysctl vm.loadavg instead..

*********linux system**********
[(01:37 PM)][(root@dedicated)] [(~)] $ cat /proc/loadavg
2.73 2.51 2.24 3/195 16583
[(01:37 PM)][(root@dedicated)] [(~)] $ uptime
 13:37:31 up 4 days,  2:28,  1 user,  load average: 2.73, 2.51, 2.24
[(01:37 PM)][(root@dedicated)] [(~)] $ cat /proc/loadavg | cut -d ' ' -f2 | sed 's/\.//g' | sed 's/^0//g'
251
[(01:37 PM)][(root@dedicated)] [(~)] $ cat /proc/loadavg | cut -d ' ' -f3 | sed 's/\.//g' | sed 's/^0//g'
224
*****************************

$ sysctl vm.loadavg
vm.loadavg: { 0.09 0.27 0.38 }

then doing this
$ sysctl vm.loadavg | cut -d ' ' -f3 | sed 's/\.//g' | sed 's/^0//g'
09

the 09 its supposed to be 009

then
$ sysctl vm.loadavg | cut -d ' ' -f2 | sed 's/\.//g' | sed 's/^0//g'
{

all im trying to do is show the same as linux
if [ "$TYPE" = "load" ]; then
INDATA=`cat /proc/loadavg | cut -d ' ' -f2 | sed 's/\.//g' | sed 's/^0//g'`
OUTDATA=`cat /proc/loadavg | cut -d ' ' -f3 | sed 's/\.//g' | sed 's/^0//g'`
fi

Open in new window

0
Comment
Question by:XK8ER
1 Comment
 
LVL 29

Accepted Solution

by:
TeRReF earned 2000 total points
ID: 22954192
$ sysctl vm.loadavg
vm.loadavg: { 0.09 0.27 0.38 }

$ sysctl vm.loadavg | cut -d ' ' -f 3 | sed 's/\.//g'
009

$ sysctl vm.loadavg | cut -d ' ' -f 4 | sed 's/\.//g'
027

$ sysctl vm.loadavg | cut -d ' ' -f 5 | sed 's/\.//g'
038
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question