[Level 3] Script for Solaris Zone FSS.

The following script that I found in the world wide web.
It is a good utility that you can adjust cpu priority with FSS for your zone.

with this helps,

regards,

Stanley Huang

#!/usr/bin/ksh
#
# zonefss - zone FSS administration. Solaris 10.
# FSS : Fair Share Scheduler
#
# 05-Apr-2005, ver 0.50 (first release)
#
# USAGE: zonefss -l | -z zone shares
# eg,
# zonefss -l # list FSS share values for all zones
# zonefss -z global 10 # set the global zone shares to 10
#
# Standard Disclaimer: This is freeware, use at your own risk.
#
# 05-Apr-2005 Brendan Gregg Created this.
#


### Process Arguments
PATH=/usr/bin:/usr/sbin
list=0
set=0
if [[ "$1" == "-l" ]]; then
shift; list=1
fi
if [[ "$1" == "-z" ]]; then
shift; set=1
zone=$1; shift
shares=$1; shift
fi




### List FSS shares
if (( list )); then
printf "%4s %-16s %s\n" "ID" "NAME" "SHARES"
for zone in `zoneadm list`
do
prctl -n zone.cpu-shares -i zone $zone | awk '
$1 ~ /^zone:/ {
zone = $3;
id = substr($2,0,(length($2)-1));
}
$1 ~ /^privileged$/ { printf("%4s %-16s %d\n",id,zone,$2); }
'
done
exit
fi


### Set FSS shares
if (( set )); then
prctl -n zone.cpu-shares -v $shares -r -i zone $zone
exit
fi


### Print usage
echo >&2 "USAGE: zonefss -l | -z zone shares
eg,
zonefss -l # list FSS share values for all zones
zonefss -z global 10 # set the global zone shares to 10"

Comments

Popular posts from this blog

[Level 2] Shell Interactive With Zenity Episode 5 -- list

[Level 2] iif in Python