From 8a3929e456fef7e01f2426e9f5f250e20bfd3c88 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 14 Nov 2005 10:05:22 +0000 Subject: [PATCH] Neu dazu --- smc.agent | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 smc.agent diff --git a/smc.agent b/smc.agent new file mode 100755 index 0000000..e62b3f0 --- /dev/null +++ b/smc.agent @@ -0,0 +1,101 @@ +#!/bin/sh +# ####################################################################### +# File : /etc/init.d/smc.agent # +# Description : start-stop-script for secure starting and stopping # +# the Sun Management Center Agent # +# Known Bugs : does not remove $LOGFILE, this must be done manually # +# Author : Frank Brehm # +# Created : 2005-04-25 # +# ####################################################################### + +# $Id: sicher.sh 315 2005-09-19 11:49:56Z fbrehm $ +# $URL: http://maria.technik.berlin.strato.de:8080/svn/scripts/trunk/solaris/sicher.sh $ + +sunmc_basedir="" +/usr/bin/pkginfo -qi SUNWescom +if [ $? -eq 0 ] ; then + sunmc_basedir=`/usr/bin/pkgparam SUNWescom BASEDIR` +else + exit 0 +fi + +# exit status +ESTS=98 + +# empty log file +LOGFILE=/tmp/smc-agent.start.`/bin/date +%Y%m%d%H%M%S` + +case "$1" in + + 'start') + + if [ -x $sunmc_basedir/SUNWsymon/sbin/es-start ] ; then + + echo "Starting Sun Management Center Agent Layer" + + cp /dev/null ${LOGFILE} + # read from logfile to stdout + tail -f ${LOGFILE} & + LPID=$! + + # Darstellung eines '.' alle 3 Sekunden + (while true; do printf "."; sleep 3; done) & + DOTPID=$! + + $sunmc_basedir/SUNWsymon/sbin/es-start -aY >$LOGFILE 2>&1 + ESTS=$? + + CONF_FILE=/etc/opt/SUNWsymon/symon.conf + if [ -f "$CONF_FILE" ] ; then + /usr/bin/grep platform "$CONF_FILE" > /dev/null + if [ $? -eq 0 ] ; then + $sunmc_basedir/SUNWsymon/sbin/es-start -l + fi + fi + + else + + echo "No $sunmc_basedir/SUNWsymon/sbin/es-start found." >$LOGFILE 2>&1 + ESTS=99 + + fi + + # give child processes some time to close file descriptors + sleep 2 + + # finish logfile output + exec 3>&2 2>/dev/null + kill $DOTPID $LPID + sleep 1 + exec 2>&3 + + # make logfile empty + cp /dev/null ${LOGFILE} + + echo + + ;; + + 'stop') + + if [ -f $sunmc_basedir/SUNWsymon/sbin/es-stop ] ; then + echo "Stopping Sun Management Center Agent Layer" + $sunmc_basedir/SUNWsymon/sbin/es-stop -alY + ESTS=$? + else + echo "No $sunmc_basedir/SUNWsymon/sbin/es-stop found." >&2 + ESTS=99 + fi + + ;; + + *) + + echo "Usage: $0 [start|stop]" >&2 + ESTS=100 + ;; + +esac + +exit ${ESTS} + -- 2.39.5