Operating System - Linux
1745924 Members
4357 Online
108723 Solutions
New Discussion юеВ

shell script for kernel parameters

 
SOLVED
Go to solution
Shivkumar
Super Advisor

shell script for kernel parameters

Hi,

I want to capture the below mentioned current configured kernel parameters in a file:-

maxfiles
nfile
maxusers
nproc
max_thread_proc
ncallout
nkthread

Can someone suggest a shell script ?

Thanks,
Shiv
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: shell script for kernel parameters

Hi Shiv:

I'm going to assume 11.11 and point you to 'kmtune'. You could do something like this:

# cat ./myparms
#!/usr/bin/sh
typeset MYLOG=/tmp/kparms.log
date >> ${MYLOG}
echo "" >> ${MYLOG}
for P in maxfiles nfile maxusers nproc max_thread_proc ncallout nkthread
do
kmtune -l -q ${P} >> ${MYLOG}
done
echo ".end." >> ${MYLOG}

...simply run as :

# ./myparms

See the manpages for more information:

http://www.docs.hp.com/en/B2355-60127/kmtune.1M.html

Regards!

...JRF...
inventsekar_1
Respected Contributor

Re: shell script for kernel parameters

Hi SHiv:
from man kmtune description in 11.23:
=====================================
kmtune is an obsolete command that is replaced by kctune(1M). Users
are encouraged to migrate to kctune(1M). kmtune will be removed in a
future release of HP-UX. The behavior of some of kmtune's options have
changed and they are noted in the appropriate sections below.
=====================================
so...

# cat >myparms_11.23

#!/usr/bin/sh
typeset MYLOG=/tmp/kparms_11.23.log
date >> ${MYLOG}
echo "" >> ${MYLOG}
for P in maxfiles nfile maxusers nproc max_thread_proc ncallout nkthread
do
kctune -v ${P} >> ${MYLOG}
done
echo ".end." >> ${MYLOG}

--------
note that maxusers, ncallout not availble in 11.23. so two errors:
--------
./myparms_11.23
ERROR: There are no tunables matching the name you specified.
ERROR: There are no tunables matching the name you specified.
--------
Be Tomorrow, Today.
Bill Hassell
Honored Contributor

Re: shell script for kernel parameters

No script necessary -- just use grep's multiple pattern option -e. Since you did not specify
the OS version, you can use the command you like:

kctune | grep -e maxfiles -e nfile -e maxusers -e nproc -e max_thread_proc -e ncallout -e nkthread

or

kmtune | grep -e maxfiles -e nfile -e maxusers -e nproc -e max_thread_proc -e ncallout -e nkthread

NOTE: maxusers if a fudge factor, not a real kernel parameter. It is used as part of several default formula settings.


Bill Hassell, sysadmin
inventsekar_1
Respected Contributor

Re: shell script for kernel parameters

no. SHivkumar's question is:

I want to capture the below mentioned current configured kernel parameters in a FILE:-

anyhow, from bill's script,

kctune | grep -e maxfiles -e nfile -e maxusers -e nproc -e max_thread_proc -e ncallout -e nkthread >/tmp/kparms_11.23.log
Be Tomorrow, Today.