Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/bin/ksh
P_HOSTNAME="${1}"
P_COMMAND="${2}"
P_VALUE="${3}"
HMC="hscroot@hmc1"
##############################################################################
### first establish that it's a legit LPAR, at least according to the database
R_HOSTNAME=`sql lpar "select hostname from lpar where hostname='${P_HOSTNAME}'"`
if test "${R_HOSTNAME}" = ""
then
echo "Undefined LPAR name ${P_HOSTNAME}"
exit
fi
##############################################################################
### second, obtain the LPAR serial number.
R_P5UNITNUMBER=`sql lpar "select hostp5 from lpar where hostname='${P_HOSTNAME}'"`
#echo "R_HOSTNAME = ${R_HOSTNAME}"
#echo "R_HOSTP5 = ${R_HOSTP5}"
#echo "R_P5UNIT = ${R_P5UNITNUMBER}"
##############################################################################
### third, figure out what exactly we're doing
case "${P_COMMAND}" in
"addcpu")
echo "ADDCPU"
ssh -n ${HMC} "chhwres -r proc -m ${R_P5UNITNUMBER} -p ${R_HOSTNAME} -o a --procs ${P_VALUE} --procunits 0.${P_VALUE}"
;;
"delcpu")
echo "DELCPU"
ssh -n ${HMC} "chhwres -r proc -m ${R_P5UNITNUMBER} -p ${R_HOSTNAME} -o r --procs ${P_VALUE} --procunits 0.${P_VALUE}"
;;
"addmem")
echo "ADDMEM"
ssh -n ${HMC} "chhwres -r mem -m ${R_P5UNITNUMBER} -p ${R_HOSTNAME} -o a -q ${P_VALUE}"
;;
"delmem")
echo "DELMEM"
ssh -n ${HMC} "chhwres -r mem -m ${R_P5UNITNUMBER} -p ${R_HOSTNAME} -o r -q ${P_VALUE}"
;;
"poweron")
echo "POWERON"
PROFILE=`sql lpar "select profile from lpar where hostname='${R_HOSTNAME}'"`
ssh -n ${HMC} "chsysstate -m ${R_P5UNITNUMBER} -r lpar -o on -n ${R_HOSTNAME} -f '${PROFILE}'"
;;
"poweroff")
echo "POWEROFF"
ssh -n ${HMC} "chsysstate -m ${R_P5UNITNUMBER} -r lpar -o shutdown --immed -n ${R_HOSTNAME}"
;;
*)
echo "Invalid command ${P_COMMAND}"
;;
esac