#############################################
#!/bin/bash
#############################################
#To check whether the depended packages ware installed
echo "-----------------------------------------------"
echo -e "To check \e[31;7msoftware's dependency\e[0m"
echo "-----------------------------------------------"
echo ""
PACKAGE="
SUNWarc SUNWbtool SUNWhea SUNWlibC SUNWlibms SUNWsprot SUNWtoo
SUNWi1of SUNWi1cs SUNWi15cs SUNWxwfnt SUNWcsl"
for i in $PACKAGE
do
pkginfo -i
$i >/dev/null
if [ "$?" =
"0" ];then
echo -e "$i is \e[32;1minstalled\e[0m"
echo ""
else
echo -e "$i is \e[31;1mnot\e[0m
\e[32;1minstalled\e[0m"
echo -e "\e[31;1minstalling\e[0m
\e[32;1m$i\e[0m"
read -p "Please input ${i}'s dir: "
pkgadd -d $REPLY $i
echo ""
echo -e "$i is \e[32;1minstalled\e[0m"
fi
done
echo "***********************************************"
sleep 1
clear
echo ""
echo "-----------------------------------------------"
echo -e "To \e[31;7mcheck again\e[0m"
echo "-----------------------------------------------"
echo ""
#To check again
for i in $PACKAGE
do
pkginfo -i
$i >/dev/null
if [ "$?" =
"0" ];then
echo -e "\e[35;1m$i\e[0m is
\e[32;4minstalled\e[0m"
fi
done
echo ""
echo "***********************************************"
#To prepare groups
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7mgroups\e[0m '\e[32;7moinstall, dba, oper,
asmadmin, asmdba, asmoper\e[0m'"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w oinstall /etc/group)" = "" ];then
/usr/sbin/groupadd -g 501 oinstall
echo -e "add
group--->\e[31;1moinstall\e[0m"
else
echo -e
"\e[31;1moinstall\e[0m is exist"
fi
if [ "$(grep -w dba /etc/group)" = "" ];then
/usr/sbin/groupadd -g 502 dba
echo -e "add
group--->\e[31;1mdba\e[0m"
else
echo -e
"\e[31;1mdba\e[0m is exist"
fi
if [ "$(grep -w oper /etc/group)" = "" ];then
/usr/sbin/groupadd -g 503 oper
echo -e "add
group--->\e[31;1moper\e[0m"
else
echo -e
"\e[31;1moper\e[0m is exist"
fi
if [ "$(grep -w asmadmin /etc/group)" = "" ];then
/usr/sbin/groupadd -g 504 asmadmin
echo -e "add
group--->\e[31;1masmadmin\e[0m"
else
echo -e
"\e[31;1masmadmin\e[0m is exist"
fi
if [ "$(grep -w asmoper /etc/group)" = "" ];then
/usr/sbin/groupadd -g 505 asmoper
echo -e "add
group--->\e[31;1masmoper\e[0m"
else
echo -e
"\e[31;1masmoper\e[0m is exist"
fi
if [ "$(grep -w asmdba /etc/group)" = "" ];then
/usr/sbin/groupadd -g 506 asmdba
echo -e "add
group--->\e[31;1masmdba\e[0m"
else
echo -e
"\e[31;1masmdba\e[0m is exist"
fi
echo "***********************************************"
#To add users
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7musers\e[0m '\e[32;7moracle,
grid\e[0m'"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w oracle /etc/passwd)" = "" ];then
echo -e "add
user--->\e[31;1moracle\e[0m"
/usr/sbin/useradd -u 502 -g oinstall -G
dba,asmdba,oper -d /export/home/oracle -m -s /usr/bin/bash -c
"Oracle Software Owner" -k /etc/skel oracle
passwd -r
files oracle
chown -R
oracle:dba /export/home/oracle
else
echo -e
"\e[31;1moracle\e[0m is exist"
fi
if [ "$(grep -w grid /etc/passwd)" = "" ];then
echo -e "add
user--->\e[31;1mgrid\e[0m"
/usr/sbin/useradd -u 503 -g oinstall -G
asmadmin,asmdba,asmoper,dba -d /export/home/grid -m -s
/usr/bin/bash -c "Grid Infrastructure Owner" -k /etc/skel
grid
passwd -r
files grid
chown -R
grid:asmdba /export/home/grid
else
echo -e
"\e[31;1mgrid\e[0m is exist"
fi
echo "***********************************************"
#To check resource limits
echo ""
echo ""
echo ""
echo "-----------------------------------------------"
echo -e "To check \e[31;7mlimits\e[0m"
echo "-----------------------------------------------"
echo ""
if [ "$(grep -w project.max-shm /etc/project)" =
"" ];then
echo -e
"\e[32;1mlimiting\e[0m "
for USER in
oracle grid
do
PROJECT_ID=$(id -p grid|cut -d'(' -f4|tr -d
')')
projmod -sK
"project.max-sem-ids=(privileged,100,deny)" $PROJECT_ID
projmod -sK
"process.max-sem-nsems=(privileged,256,deny)" $PROJECT_ID
projmod -sK
"project.max-shm-memory=(privileged,4294967295,deny)"
$PROJECT_ID
projmod -sK
"project.max-shm-ids=(privileged,100,deny)" $PROJECT_ID
done
else
##############process##############
echo -e "A
\e[32;1mlimit\e[0m is \e[31;1mexist\e[0m"
echo
""
for USER in
oracle grid
do
PROJECT_ID=$(id -p grid|cut -d'(' -f4|tr -d
')')
for VAR in "project.max-sem-ids"
"project.max-shm-memory" "project.max-shm-ids"
do