Aller au contenu

[UNIX][Webshére] Script interface simplifié de management vtwas –> ARTICLE NON TERMINE

 

ARTICLE NON TERMINE

Hello

J’ai créé un script de management de WAS  (Webshere Application Serveur ) afin de me faciliter le management de mes serveur d’application sur WAS 🙂 (et hébérgé sur unix  )

VOici la béte 🙂  mais il vous faut le modifier pour l’adapter à vos serveurs (en rouge ci-dessous )

Ci-dessous le 1er script : vtwas (il y a 2 autres scripts à prendre  voir ci-dessous ) 

 

Script WAs_Structure

 

#/bin/ksh # by bibliogeek #----------------------------------------------------------------------------------------------------- # Definition des caracteres speciaux #----------------------------------------------------------------------------------------------------- #Variable ${USER} Chargée par varaibles d'env #----------------------------------------------------------------------------------------------------- if [ "${TERM-default}" != "default" ] ; then gras=`tput bold` soul=`tput smul` reve=`tput rev` annu=`tput sgr0` clsc=`tput clear` fi clear INSTALLPATH=/Chemin d'installation de votre Webshére/profiles #Pour module strucute was associé au vtwas (télécharge (voir plus bas) le script WAs_Structure puis renseigner le Path ci-dessous :-) SCRIPTSTRUCTUREWAS=/Chemin du script/WAS_Structure #Pour module HeapDump associé au vtwas (télécharge (voir plus bas) le script Was_GetLog puis renseigner le Path ci-dessous :-) SCRIPTWAS_GETLOG=/Chemin du script/WAS_GetLog alias PS='/usr/ucb/ps -auxwww' cd $INSTALLPATH ls>/tmp/listProfile echo =======LISTING DES PROFILES========================================= for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers" ] then echo $X echo $X>>/tmp/listProfiletmp fi done echo ==================================================================== mv /tmp/listProfiletmp /tmp/listProfile RC=$? if [ ${RC} != 0 ] then clear print "Probleme lors du lancement de l'utilitaire !" print "ATTENTION A UTILISER VERSION 7 WAS MINIMUN" exit 1 fi PS|grep java |grep nodeagent>/dev/null RC=$? if [ ${RC} = 0 ] then NBRNODE=$(PS |grep java|grep nodeagent |wc -l) echo "NODE: il y a $NBRNODE Node(s) de demarre(s)" echo "" for X in $(cat /tmp/listProfile) do PS|grep java |grep nodeagent|grep $X>/dev/null RC=$? if [ ${RC} = 0 ] then echo "- le Node du Serveur $X est demarre" fi done else echo "NODE: Pas de Node demarre " fi echo " " PS|grep java |grep dmgr>/dev/null RC=$? if [ ${RC} = 0 ] then NBRDMGR=$(PS |grep java|grep dmgr |wc -l) echo "DMGR: il y a $NBRDMGR DMGR(s) de demarre(s)" echo"" for X in $(cat /tmp/listProfile) do PS|grep java |grep dmgr|grep $X>/dev/null RC=$? if [ ${RC} = 0 ] then echo "- le DMGR du Serveur $X est demarre" fi done else echo "DMGR: Pas de DMGR demarre" fi echo " " echo SERVER APPLICATION for X in $(cat /tmp/listProfile) do cd $INSTALLPATH cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server for Y in $(cat /tmp/tmp_Server) do PS|grep java |grep $Y|grep -v dmgr |grep -v nodeagent >/dev/null RC=$? if [ ${RC} = 0 ] then SAPID=$(cat $INSTALLPATH/$X/logs/$Y/$Y.pid) echo "- le serveur application $Y est demarre PID : $SAPID" fi done done #----------------------------------------------------------------------------------------------------- while [ "$i" != "q" ]; do echo "==================================================================" echo "=======Administration WAS=========================================" print "" print "Selectionner une option" print "" print - "\n${reve}" " 1" "${annu}" " Start NODE" print - "\n${reve}" " 2" "${annu}" " Stop NODE" print - "\n${reve}" " 3" "${annu}" " Liste Processus" print - "\n${reve}" " 4" "${annu}" " Start Serveur Application" print - "\n${reve}" " 5" "${annu}" " Stop Serveur Application" print - "\n${reve}" " 6" "${annu}" " Voir les logs des Serveurs D'Application" print - "\n${reve}" " 7" "${annu}" " HeapDump / Thread Dump / Collecte de log WAS" print - "\n${reve}" " 8" "${annu}" " Affichage Structure Webshere relatif a la machine" print - "\n${reve}" " q" "${annu}" " Quitter" unset e read i if [ "$i" == "1" ]; then #CHOIX1 ------------------------------------------------------------ clear echo "Taper le nom du profile du Node Ç dëmarrer " echo "******* Liste Profile*******" echo "-------------------------------------------------------------" cat /tmp/listProfile echo "-------------------------------------------------------------" print - "\n${reve}" " q" "${annu}" " Quitter" read e while [ "$e" != "q" ]; do cd $INSTALLPATH ./$e/bin/startNode.sh RC=$? if [ ${RC} = 0 ] then echo "- Le NODE $Y est demarre" fi echo "-->Fin de commande -------------------------------------------------------------" read e done clear fi if [ "$i" == "2" ]; then #CHOIX2 ------------------------------------------------------------ clear echo "=======LISTING DES PROFILES=========================================" echo "-------------------------------------------------------------" cat /tmp/listProfile echo "-------------------------------------------------------------" print - "Taper le nom du profile du \n${reve}" " Node " "${annu}" " à arreter " print - "\n${reve}" " q" "${annu}" " Quitter" read e while [ "$e" != "q" ]; do cd $INSTALLPATH ./$e/bin/stopNode.sh RC=$? if [ ${RC} = 0 ] then echo "- Le NODE $Y est arretë" fi echo "-->Fin de commande -------------------------------------------------------------" read e done clear fi if [ "$i" == "3" ]; then #CHOIX3 ------------------------------------------------------------ clear echo "=======LISTING DES PROFILES=========================================" for X in $(cat /tmp/listProfile) do echo $X done echo ===================================================================================================== PS|grep java |grep nodeagent>/dev/null RC=$? if [ ${RC} = 0 ] then NBRNODE=$(PS |grep java|grep nodeagent |wc -l) echo "NODE: il y a $NBRNODE Node(s) de demarre(s)" echo "" for X in $(cat /tmp/listProfile) do PS|grep java |grep nodeagent|grep $X>/dev/null RC=$? if [ ${RC} = 0 ] then echo "- le Node du Serveur $X est demarre" fi done else echo "NODE: Pas de Node demarre " fi echo " " PS|grep java |grep dmgr>/dev/null RC=$? if [ ${RC} = 0 ] then NBRDMGR=$(PS |grep java|grep dmgr |wc -l) echo "DMGR: il y a $NBRDMGR DMGR(s) de demarre(s)" echo"" for X in $(cat /tmp/listProfile) do PS|grep java |grep dmgr|grep $X>/dev/null RC=$? if [ ${RC} = 0 ] then echo "- le DMGR du Serveur $X est demarre" fi done fi echo " " echo SERVER APPLICATION for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server for Y in $(cat /tmp/tmp_Server) do PS|grep java |grep $Y|grep -v dmgr |grep -v nodeagent >/dev/null RC=$? if [ ${RC} = 0 ] then SAPID=$(cat $INSTALLPATH/$X/logs/$Y/$Y.pid) echo "- le serveur application $Y est demarre PID : $SAPID" fi done done fi if [ "$i" == "4" ]; then echo $e while [ "$e" != "q" ]; do #CHOIX4 ------------------------------------------------------------ clear echo "******* Liste Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application a demarrer " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------DEMARRAGE EN COURS------------" ./$X/bin/startServer.sh $e RC=$? if [ ${RC} = 0 ] then echo "- Le Serveur Application $Y est demarre" fi echo "-->Fin de commande -------------------------------------------------------------" fi done fi done fi if [ "$i" == "5" ]; then while [ "$e" != "q" ]; do #CHOIX5 ------------------------------------------------------------ clear echo "******* Liste Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application a Stopper " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------STOP EN COURS------------" ./$X/bin/stopServer.sh $e RC=$? if [ ${RC} = 0 ];then echo "- Le Serveur Application $Y est Arretë" fi echo "-->Fin de commande -------------------------------------------------------------" fi done fi done fi if [ "$i" == "6" ]; then clear while [ "$choix" != "q" ]; do #CHOIX6 ------------------------------------------------------------ print "Selectionner une option" print - "\n${reve}" " a" "${annu}" " Visualiser la log SystemOut.log" print - "\n${reve}" " b" "${annu}" " Tail -f de SystemOut.log" print - "\n${reve}" " c" "${annu}" " Visualiser la log SystemErr.log" print - "\n${reve}" " d" "${annu}" " Tail -f SystemErr.log" print - "\n${reve}" " q" "${annu}" " Quitter" read choix case $choix in a) echo "******* LOG Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application ou vous souhaitez aller consulter la logs " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------Déplacement sur le path de la logs------------" cat ./$X/logs/$e/SystemOut.log echo "-->Fin de commande -------------------------------------------------------------" fi done fi ;; b) echo "******* LOG Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application ou vous souhaitez aller consulter la logs " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------Déplacement sur le path de la logs------------" tail -f ./$X/logs/$e/SystemOut.log echo "-->Fin de commande -------------------------------------------------------------" fi done fi ;; c) echo "******* LOG Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application ou vous souhaitez aller consulter la logs " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------Déplacement sur le path de la logs------------" tail -f ./$X/logs/$e/SystemErr.log echo "-->Fin de commande -------------------------------------------------------------" fi done fi ;; d) echo "******* LOG Serveur App*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Taper le nom du serveur d application ou vous souhaitez aller consulter la logs " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then cd $INSTALLPATH for X in $(cat /tmp/listProfile) do if [ -d "./$X/servers/$e" ];then echo "------------Déplacement sur le path de la logs------------" tail -f ./$X/logs/$e/SystemErr.log echo "-->Fin de commande -------------------------------------------------------------" fi done fi ;; q) echo quit ;; esac done fi if [ "$i" == "7" ]; then clear echo $e clear while [ "$e" != "q" ]; do #CHOIX7 ------------------------------------------------------------ echo "******* Liste Serveur App pour HEAPDUMp/THREAD DUMP ,Collecte log was*******" echo "-------------------------------------------------------------" for X in $(cat /tmp/listProfile) do cd $INSTALLPATH/$X/servers echo initialisation_du_fichier_tmp_server>/tmp/tmp_Server ls|grep -v nodeagent>>/tmp/tmp_Server grep -v initialisation /tmp/tmp_Server>/tmp/tmp_ServerTmpServeur for Y in $(cat /tmp/tmp_ServerTmpServeur) do echo "$Y " done done echo "-------------------------------------------------------------" echo "Préciser Le nom du WebServeur (ex CC191_1) en choissisant un de la liste proposé " print - "\n${reve}" " q" "${annu}" " Quitter" read e if [ "$e" != "q" ]; then M=$(hostname) C=$e print "Souhaitez vous un HeapDump ? yes or no" read i case ${i} in no) H=noheapdump ;; yes) H=yesheapdump ;; *) echo "==================================================================" echo "yes or no pas autre chose , sorti du programme " echo "==================================================================" exit 0 ;; esac echo "==================================================================" $SCRIPTWAS_GETLOG -vtwas -M=${M} -C=${C} -H=${H} fi done fi if [ "$i" == "8" ]; then clear echo "******* Structure WAS*******" $SCRIPTSTRUCTUREWAS fi done

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *