Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=====begin of copyright notice=====
- copyright()
- {
- echo -e "
- THE AULIX_UTILS FOR DEBIAN AND CENTOS \n
- The AUTHOR of this file is Alexander Borisovich Prokopyev, Kurgan, Russia \n
- More info can be found at the AUTHOR's website: http://www.aulix.com/resume \n
- Contact: alexander.prokopyev at aulix dot com \n
- Copyright (c) Alexander Prokopyev, 2006-2014 \n
- All materials contained in this file are protected by copyright law. \n
- Nobody except the AUTHOR may alter or remove this copyright notice from copies of the content. \n
- The AUTHOR allows to use this content under AGPL v3 license:
- http://opensource.org/licenses/agpl-v3.html
- ";
- }
- copyright;
- #=====end of copyright notice=====
- db2_cmd=/utils/db2/db2.sh;
- was_cmd=/utils/db2/was.sh;
- source /utils/custom/was_vars.sh;
- Action=$1;
- start_was()
- {
- rm -f /opt/IBM/WebSphere/AppServer/profiles/default/javacore.*.txt;
- /opt/IBM/WebSphere/AppServer/bin/startServer.sh server1 -username $WASUser -password $WASPassword;
- }
- stop_was()
- {
- /opt/IBM/WebSphere/AppServer/bin/stopServer.sh server1 -username $WASUser -password $WASPassword;
- }
- list_dumps()
- {
- ls -al /opt/IBM/WebSphere/AppServer/profiles/default/javacore.*.txt;
- }
- network_access()
- {
- AccessType=$1;
- case $AccessType in
- ( users | admins )
- ssh $DB2Host "/utils/net/firehol.sh $AccessType";
- /utils/net/firehol.sh $AccessType;
- ;;
- ( * )
- echo "Error: incorrect network access level specified! Should be: users or admins.";
- exit 1;
- ;;
- esac;
- case $AccessType in
- ( users )
- service cron restart;
- ;;
- ( admins )
- service cron stop;
- ;;
- esac;
- }
- reboot_both()
- {
- stop_was;
- ssh $DB2Host "db2stop force; sync; reboot;";
- sync; reboot;
- }
- backup_db()
- {
- stop_was;
- ssh $DB2Host /utils/custom/backup_db.sh;
- }
- case $Action in
- ( restart_was )
- stop_was;
- start_was;
- ;;
- ( db2top | db2topa )
- if [ -z "$2" ]; then
- {
- 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
- }
- else
- {
- if [ "$Action" == "db2topa" ]; then
- {
- ssh $DB2Host db2top -d $DBName -a -b $2 -s 1 -x;
- }
- else
- {
- ssh $DB2Host db2top -d $DBName -b $2 -s 1 -x;
- }
- fi;
- }
- fi;
- ;;
- ( show_state )
- $was_cmd db2top U;
- $was_cmd db2top l;
- ;;
- ( stop_was | start_was | show_date | reboot_both | list_dumps | clean_tmp )
- $Action;
- ;;
- ( stop )
- stop_was;
- ;;
- ( start )
- start_was;
- ;;
- ( restart )
- stop_was;
- start_was;
- ;;
- ( backup_db )
- network_access admins;
- backup_db;
- network_access users;
- ;;
- ( del_was_logs )
- rm -Rf /utils/custom/was_logs/*;
- ;;
- ( network_access )
- network_access $2;
- ;;
- ( change_date )
- echo "Date format: mm/dd/yyyy. Time is kept";
- change_date "$2";
- ;;
- ( change_date_back )
- backup_db;
- change_date "12/31/2009";
- ;;
- ( * )
- echo "Пожалуйста, укажите правильную команду, например: create_user username password"
- exit 1;
- ;;
- esac;
Advertisement
Add Comment
Please, Sign In to add comment