Difference between revisions of "Get cpu count with bash script"
From DevOps Notebook
(Created page with "<syntaxhighlight lang="bash"> #!/bin/bash CPUCOUNT=`cat /proc/cpuinfo |grep processor |wc -l` echo "CPU COUNT IS: " $CPUCOUNT if [ $CPUCOUNT -lt "5" ] then MAXSES...") |
|||
Line 1: | Line 1: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
− | |||
− | |||
− | |||
CPUCOUNT=`cat /proc/cpuinfo |grep processor |wc -l` | CPUCOUNT=`cat /proc/cpuinfo |grep processor |wc -l` | ||
− | |||
− | |||
− | |||
echo "CPU COUNT IS: " $CPUCOUNT | echo "CPU COUNT IS: " $CPUCOUNT | ||
− | |||
− | |||
if [ $CPUCOUNT -lt "5" ] | if [ $CPUCOUNT -lt "5" ] | ||
− | |||
then | then | ||
− | |||
MAXSESSIONS="7" | MAXSESSIONS="7" | ||
− | |||
else | else | ||
− | |||
MAXSESSIONS="12" | MAXSESSIONS="12" | ||
− | |||
fi | fi | ||
− | |||
echo "max session:" $MAXSESSIONS | echo "max session:" $MAXSESSIONS | ||
− | |||
− | |||
</syntaxhighlight | </syntaxhighlight |
Revision as of 17:50, 27 January 2022
<syntaxhighlight lang="bash">
- !/bin/bash
CPUCOUNT=`cat /proc/cpuinfo |grep processor |wc -l` echo "CPU COUNT IS: " $CPUCOUNT
if [ $CPUCOUNT -lt "5" ] then MAXSESSIONS="7" else MAXSESSIONS="12" fi echo "max session:" $MAXSESSIONS </syntaxhighlight