Created
June 14, 2017 14:18
-
-
Save wuftymerguftyguff/2ac17fd60115f4bb0189dd4dce44ff7c to your computer and use it in GitHub Desktop.
A Set of Bash Scripts to control SAP application instances from VCS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
monitorapp.sh | |
#!/bin/bash | |
#CONSTANTS | |
OFFLINE=100 | |
UNKNOWN=99 | |
ONLINE=110 | |
#Command Line Parameters | |
APPSERVER=$1 | |
INSTNO=$2 | |
SIDADM=$3 | |
PASSWORD=$4 | |
STATUS=$UNKNOWN | |
#Capture command output | |
SAPCONTROL=$(sapcontrol -nr $INSTNO -u $SIDADM $PASSWORD -host $APPSERVER -function GetProcessList) | |
#A count of not GREEN processes | |
NOTGREEN=$(echo $SAPCONTROL |grep -oP "\b[A-Z]{4,}\b" | grep -v GREEN| wc -l) | |
#A count of not GRAY processes | |
NOTGRAY=$(echo $SAPCONTROL |grep -oP "\b[A-Z]{4,}\b" | grep -v GRAY|wc -l) | |
if [ $NOTGREEN -eq 0 ] | |
then | |
STATUS=$ONLINE | |
fi | |
if [ $NOTGRAY -eq 0 ] | |
then | |
STATUS=$OFFLINE | |
fi | |
exit $STATUS | |
stopapp.sh | |
#!/bin/bash | |
APPSERVER=$1 | |
INSTNO=$2 | |
SIDADM=$3 | |
PASSWORD=$4 | |
sapcontrol -host $APPSERVER -nr $INSTNO -user $SIDADM $PASSWORD -function Stop | |
exit 0 | |
startapp.sh | |
#!/bin/bash | |
APPSERVER=$1 | |
INSTNO=$2 | |
SIDADM=$3 | |
PASSWORD=$4 | |
sapcontrol -host $APPSERVER -nr $INSTNO -user $SIDADM $PASSWORD -function Start | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jeff I have a question about your script. are you still active on diem profiles?