--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+SERVER_LIST=$( cat <<-EOF
+ aurora.pixelpark.net test-www01-bibliomed-de
+ beaver.pixelpark.com
+ cell.pixelpark.com
+ consus.pixelpark.net test-www02-bibliomed-de
+ erebus.pixelpark.net
+ gna.pixelpark.com iwc01 caldav01
+ hektor.pixelpark.com
+ horen.pixelpark.com
+ intra-collective01.pixelpark.com
+ libs.pixelpark.com
+ megaira.pixelpark.net www02-bibliomed-de
+ merlin.pixelpark.net www-mb-kampagnen-de
+ nb-58-01.pixelpark.com
+ nb-58-02.pixelpark.com
+ nechtan.pixelpark.com
+ nox.pixelpark.com
+ nut.pixelpark.com mysql-pp06
+ nyx.pixelpark.com
+ pan.pixelpark.com
+ phoenix-dom01.pixelpark.com
+ phoenix-dom02.pixelpark.com
+ pluton01.pixelpark.com global
+ spes.pixelpark.com
+ tantalos.pixelpark.com global
+ tyr.pixelpark.com
+ EOF
+)
+
+PURE_ROOT_SERVERS="
+gna.pixelpark.com
+nut.pixelpark.com
+pluton01.pixelpark.com
+"
+
+THIS_SCRIPT=$( readlink -f "${0}" )
+BIN_DIR=$( dirname "${THIS_SCRIPT}" )
+USER="frank.brehm"
+
+if [[ ! -r "${BIN_DIR}/solaris.rc" ]] ; then
+ echo "Resource file '${BIN_DIR}/solaris.rc' not found." >&2
+ exit 66
+fi
+source "${BIN_DIR}/solaris.rc"
+
+check_for_park() {
+ local server="${1}"
+ local user="${2}"
+ local zone="${3}"
+ local fs=
+
+ local pf=
+ if [[ "${zone}" == "global" ]] ; then
+ pf="/usr/bin/pfexec /usr/sbin/zlogin ${zone} "
+ fi
+
+ echo " checking for mounted /park filesystem:"
+ cmd="${pf}df -k | grep ' /park' | awk '{print \$6}'"
+
+ local mounted_parks=
+ if echo "${PURE_ROOT_SERVERS}" | grep -q -w "${server}" ; then
+ mounted_parks=$( exec_remote "${server}" "${user}" "${cmd}" "${PW_FILE}" || true )
+ else
+ mounted_parks=$( exec_remote "${server}" "${user}" "${cmd}" || true )
+ fi
+ for fs in ${mounted_parks}; do
+ echo " - ${fs}"
+ done
+
+ if [[ -n "${mounted_parks}" ]] ; then
+
+ cmd=
+
+ fi
+
+}
+
+main() {
+
+ local -a servers=()
+
+ local line=
+ local server=
+ local zone=
+ local o_ifs="${IFS}"
+ IFS="
+"
+ for line in ${SERVER_LIST} ; do
+ server=$( echo "${line}" | awk '{print $1}' )
+ servers+=( "${server}" )
+ done
+ IFS="${o_ifs}"
+
+ for server in "${servers[@]}" ; do
+ echo
+ line=$( echo "${SERVER_LIST}" | \
+ grep -w "${server}" | \
+ sed -e 's/^[^[:space:]][^[:space:]]*[[:space:]]*//' )
+ echo "${server}:"
+ if [[ -z "${line}" ]] ; then
+ line=$( get_solaris_zones "${server}" "${USER}" )
+ fi
+
+ for zone in ${line}; do
+ echo " - Zone ${zone}"
+ check_for_park "${server}" "${USER}" "${zone}"
+ done
+
+ done
+
+}
+
+main
+
+
+# vim: et ts=4 shiftwidth=4 softtabstop=4 list
--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+
+PW_FILE="/home/fbrehm/.private/bla.txt"
+
+exec_remote() {
+
+ local host="${1}"
+ local cmd="${2}"
+ local pw_file=
+ if [[ "$#" -ge 3 ]] ; then
+ pw_file="${3}"
+ fi
+
+ if [[ -z "${pw_file}" ]] ; then
+ ssh -X root@${host} "${cmd}"
+ else
+ sshpass -f "${pw_file}" ssh -X root@${host} "${cmd}"
+ fi
+
+}
+
+
+get_solaris_zones() {
+
+ local host="${1}"
+ local pw_file=
+ if [[ "$#" -ge 2 ]] ; then
+ pw_file="${2}"
+ fi
+
+ local zone=
+ local -a zones=()
+
+ if exec_remote "${host}" "true" "${pw_file}" ; then
+ :
+ else
+ return 0
+ fi
+
+ cmd=$( cat <<-EOF
+ if [ ! -x /usr/sbin/zoneadm ] ; then
+ exit 0
+ fi
+ /usr/sbin/zoneadm list
+ EOF
+ )
+
+ for zone in $( exec_remote "${host}" "${cmd}" "${pw_file}" ) ; do
+ zones+=( "${zone}" )
+ done
+
+ echo "${zones[@]}"
+
+}
+
+get_solaris_zones "intra-collective01.pixelpark.com" "${PW_FILE}"
+
+
+# vim: et ts=4 shiftwidth=4 softtabstop=4 list
--- /dev/null
+#!/bin/bash
+
+PW_FILE="/home/fbrehm/.private/bla.txt"
+
+exec_remote() {
+
+ local host="${1}"
+ local user="${2}"
+ local cmd="${3}"
+ local pw_file=
+ if [[ "$#" -ge 4 ]] ; then
+ pw_file="${4}"
+ fi
+
+ if [[ -z "${pw_file}" ]] ; then
+ ssh -o StrictHostKeyChecking=no -x -l "${user}" "${host}" "${cmd}"
+ else
+ sshpass -f "${pw_file}" ssh -o StrictHostKeyChecking=no -x -l "${user}" "${host}" "${cmd}"
+ fi
+
+}
+
+
+get_solaris_zones() {
+
+ local host="${1}"
+ local user="${2}"
+ local pw_file=
+ if [[ "$#" -ge 3 ]] ; then
+ pw_file="${3}"
+ fi
+
+ local zone=
+ local -a zones=()
+
+ if exec_remote "${host}" "${user}" "true" "${pw_file}" ; then
+ :
+ else
+ return 0
+ fi
+
+ cmd=$( cat <<-EOF
+ if [ ! -x /usr/sbin/zoneadm ] ; then
+ exit 0
+ fi
+ /usr/sbin/zoneadm list
+ EOF
+ )
+
+ for zone in $( exec_remote "${host}" "${user}" "${cmd}" "${pw_file}" ) ; do
+ zones+=( "${zone}" )
+ done
+
+ echo "${zones[@]}"
+
+}
+
+# vim: filetype=sh et ts=4 shiftwidth=4 softtabstop=4 list