sany_ok

was

Nov 11th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.72 KB | None | 0 0
  1. #=====begin of copyright notice=====
  2. copyright()
  3. {
  4.         echo -e "
  5.  
  6.        THE AULIX_UTILS FOR DEBIAN AND CENTOS \n
  7.        The AUTHOR of this file is Alexander Borisovich Prokopyev, Kurgan, Russia \n
  8.        More info can be found at the AUTHOR's website: http://www.aulix.com/resume \n
  9.        Contact: alexander.prokopyev at aulix dot com \n
  10.        
  11.        Copyright (c) Alexander Prokopyev, 2006-2014 \n
  12.  
  13.        All materials contained in this file are protected by copyright law. \n
  14.        Nobody except the AUTHOR may alter or remove this copyright notice from copies of the content. \n
  15.        
  16.        The AUTHOR allows to use this content under AGPL v3 license:
  17.        http://opensource.org/licenses/agpl-v3.html
  18.  
  19.        ";
  20. }
  21.  
  22. copyright;
  23. #=====end of copyright notice=====
  24.  
  25.  
  26. db2_cmd=/utils/db2/db2.sh;
  27. was_cmd=/utils/db2/was.sh;
  28.  
  29. source /utils/custom/was_vars.sh;
  30. Action=$1;
  31.  
  32. start_was()
  33. {
  34.         rm -f /opt/IBM/WebSphere/AppServer/profiles/default/javacore.*.txt;
  35.         /opt/IBM/WebSphere/AppServer/bin/startServer.sh server1 -username $WASUser -password $WASPassword;
  36. }
  37.  
  38. stop_was()
  39. {
  40.         /opt/IBM/WebSphere/AppServer/bin/stopServer.sh server1 -username $WASUser -password $WASPassword;
  41. }
  42.  
  43. list_dumps()
  44. {
  45.         ls -al /opt/IBM/WebSphere/AppServer/profiles/default/javacore.*.txt;
  46. }
  47.  
  48. network_access()
  49. {
  50.         AccessType=$1;
  51.         case $AccessType in
  52.         ( users | admins )
  53.                 ssh $DB2Host "/utils/net/firehol.sh $AccessType";
  54.                 /utils/net/firehol.sh $AccessType;
  55.         ;;
  56.         ( * )
  57.                 echo "Error: incorrect network access level specified! Should be: users or admins.";
  58.                 exit 1;
  59.         ;;
  60.         esac;
  61.         case $AccessType in
  62.         ( users )
  63.                 service cron restart;
  64.         ;;
  65.         ( admins )
  66.                 service cron stop;
  67.         ;;
  68.         esac;
  69. }
  70.  
  71. reboot_both()
  72. {
  73.         stop_was;
  74.         ssh $DB2Host "db2stop force; sync; reboot;";
  75.         sync; reboot;
  76. }
  77.  
  78. backup_db()
  79. {
  80.         stop_was;
  81.         ssh $DB2Host /utils/custom/backup_db.sh;
  82. }
  83.  
  84. case $Action in
  85.  
  86. ( restart_was )
  87.         stop_was;
  88.         start_was;
  89. ;;
  90.  
  91. ( db2top | db2topa )
  92.         if [ -z "$2" ]; then
  93.         {
  94.                 echo d=database, l=sessions, t=tablespaces, b=bufferpools, T=tables, D=Dynamic SQL, s=Statements, U=Locks, u=Utilities, F=Federation, m=Memory -X=XML Output, -L=Write queries to ALL.sql, -A=Performance analysis
  95.         }
  96.         else
  97.         {
  98.                 if [ "$Action" == "db2topa" ]; then
  99.                 {
  100.                         ssh $DB2Host db2top -d $DBName -a -b $2 -s 1 -x;
  101.                 }
  102.                 else
  103.                 {
  104.                         ssh $DB2Host db2top -d $DBName -b $2 -s 1 -x;
  105.                 }
  106.                 fi;
  107.         }
  108.         fi;
  109. ;;
  110.  
  111. ( show_state )
  112.         $was_cmd db2top U;
  113.         $was_cmd db2top l;
  114. ;;
  115.  
  116. ( stop_was | start_was | show_date | reboot_both | list_dumps | clean_tmp )
  117.         $Action;
  118. ;;
  119.  
  120. ( stop )
  121.         stop_was;
  122. ;;
  123.  
  124. ( start )
  125.         start_was;
  126. ;;
  127.  
  128. ( restart )
  129.         stop_was;
  130.         start_was;
  131. ;;
  132.  
  133. ( backup_db )
  134.         network_access admins;
  135.         backup_db;
  136.         network_access users;
  137. ;;
  138.  
  139. ( del_was_logs )
  140.         rm -Rf /utils/custom/was_logs/*;
  141. ;;
  142.  
  143. ( network_access )
  144.         network_access $2;
  145. ;;
  146.  
  147. ( change_date )
  148.         echo "Date format: mm/dd/yyyy. Time is kept";
  149.         change_date "$2";
  150. ;;
  151.  
  152. ( change_date_back )
  153.         backup_db;
  154.         change_date "12/31/2009";
  155. ;;
  156.  
  157. ( * )
  158.         echo "Пожалуйста, укажите правильную команду, например: create_user username password"
  159.         exit 1;
  160. ;;
  161.  
  162. esac;
Advertisement
Add Comment
Please, Sign In to add comment