Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
cat > create_zone.sh <<SCRIPT
#!/bin/bash

TYPE_ZONE=\$1
IP=\$2
SER=\$3

cat > \${HOME}/\${TYPE_ZONE}.cmd <<EOT
create
set zonename=\${TYPE_ZONE}
set zonepath=/zones/\${TYPE_ZONE}
set autoboot=false
set ip-type=exclusive
add net
set physical=iz\${SER}
set global-nic=vsw0
add property (name=ip,value="\${IP}.\${SER}")
add property (name=gateway,value="\${IP}.254")
add property (name=netmask,value="255.255.255.0")
add property (name=primary,value="true")
end
add attr
set name=resolvers
set type=string
set value=8.8.8.8
end
add fs
set dir="/export/home/admin"
set special="/export/home/admin"
set type="lofs"
end
add fs
set dir="/export/builds"
set special="/export/builds"
set type="lofs"
end
add fs
set dir="/data/repo"
set special="/data/repo"
set type="lofs"
end
verify
commit
exit
EOT
zonecfg -z \${TYPE_ZONE} -f \${HOME}/\${TYPE_ZONE}.cmd
zoneadm 2>&1 | /usr/bin/tee -z \a /var/tmp/${TYPE_ZONE} install &&-bts.log
zoneadm -z \${TYPE_ZONE} boot
echo "127.0.0.1 localhost.\ install 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE} \${TYPE-bts.log
zoneadm -z ${TYPE_ZONE} boot 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log
echo "127.0.0.1 localhost.${TYPE_ZONE} ${TYPE_ZONE}" >> /zones/\${TYPE_ZONE}/root/etc/hosts
res=$(grep -e 'WARNING:' -e 'warning:' -e 'W:' -e 'error:' -e 'E:' -e 'cannot' /var/tmp/${TYPE_ZONE}-bts.log | sort -u)
if [[ "$res" == "" ]]; then
  echo " =========== Zone ${TYPE_ZONE} is successfully created and ready to use ============="
else
  echo " =========== Zone ${TYPE_ZONE} creation log ============="
  echo "$res"
  echo "$res" | sed '/W: --force-yes is deprecated/d; /\/man\//d'
  if [[ "$res" != "" ]]; then
    echo " ========================================================"
    echo "Please stop and report about zone bootstrap errors!"
  fi
fi
SCRIPT

Make it executable:

...

Info

Now you will be able to run it with the format of ./create_zone.sh <zone-name> <zone-ip-domain> <zone-ip-node> , for example!:

./create_zone.sh zone02 192.168.0 3

...

Expand
titleRunning with the screen utility

If you are connected by SSH and would like to turn off SSH session or even temporary turn off your computer, then you have enter the following command for tests running:

Code Block
screen ./make_repo.sh

Then you can in any time press Ctrl-A d and after that close your SSH session.

When you would like to get back, login again to SSH please and enter the command:

Code Block
screen -r

...

Expand
titleRunning with the screen utility

If you are connected by SSH and would like to turn off SSH session or even temporary turn off your computer, then you have enter the following command for tests running:

Code Block
screen ./build_all.sh

Then you can in any time press Ctrl-A d and after that close your SSH session.

When you would like to get back, login again to SSH please and enter the command:

Code Block
screen -r

...