Tip

WebSphere 3.5 application start/stop utility

This CL program may be used to start or stop a Websphere 3.5 application server from a green-screen command line, via a submitted job. It comes in handy when there is a desire to automate stopping and starting of individual WebSphere app servers.

The WSCP interface is used and it works fine on WebSphere 3.5.4 (Std and Adv) and above. Although not tested on WAS 4.0, it should work after changing the path on the "CD" command to the appropriate 4.0 path (e.g. WebASAdv4).


  /*********************************************************************/ 
/* Function:   Start/Stop Websphere Application Server               */ 
/* Date:       17Jun02                                               */ 
/* By:         C.Schletty                                            */ 
/*                                                                   */ 
/* This program starts or stops the specified Websphere App Server   */ 
/* It uses the WSCP command line interface which is invoked via      */ 
/* Qshell.  The two-line script is passed as a parameter to Qshell.  */ 
/*                                                                   */ 
/* Parameters: Application Server Name (25 char)                     */ 
/*             Action (stop | start)                                 */ 
/*                                                                   */ 
/*                                                                   */ 
/* Example Qshell command script:                                    */ 
/*                                                                   */ 
/*   cd /QIBM/ProdData/WebASAdv/bin                                  */ 
/*                                                                   */ 
/*   wscp -c ApplicationServer start                                 */ 
/*           /Node:myas400/ApplicationServer:myapp/                  */ 
/*                                                                   */ 
/*********************************************************************/ 
                                                                        
             PGM        PARM(&SERVER &ACTION)                           
                                                                        
/*********************************************************************/ 
/* Variables */                                                         
/*********************************************************************/ 
                                                                        
             DCL        VAR(&NODE) TYPE(*CHAR) LEN(25) +                
                          VALUE('myas400') /* This is +    
                          the name of the NODE as know by Websphere */  
             DCL        VAR(&SERVER) TYPE(*CHAR) LEN(25)                
             DCL        VAR(&ACTION) TYPE(*CHAR) LEN(5)                 
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(200)                  
                                                                        
/*********************************************************************/ 
/* Default error handling */                                            
/*********************************************************************/ 
                                                                        
             MONMSG     MSGID(CPF0000)  /**/                            
                                                                        
/*********************************************************************/ 
/* Validate action.                                                  */ 
/*********************************************************************/ 
                                                                        
/* Insure action is lower case. */                                      
                                                                        
              IF         COND(&ACTION = 'START') THEN(CHGVAR +           
                           VAR(&ACTION) VALUE('start'))                  
              IF         COND(&ACTION = 'STOP') THEN(CHGVAR +            
                           VAR(&ACTION) VALUE('stop'))                   
                                                                         
 /* Only 'start' or 'stop' is valid. */                                  
                                                                         
              IF         COND((&ACTION *NE 'start') *AND (&ACTION *NE +  
                           'stop')) THEN(SNDPGMMSG MSGID(CPF9898) +      
                           MSGF(QCPFMSG) MSGDTA('Invalid Action.  +      
                           Should be ''stop'' or ''start''') +           
                           MSGTYPE(*ESCAPE))                             
                                                                         
 /*********************************************************************/ 
 /* Start Server.                                                     */ 
 /*********************************************************************/ 
                                                                         
 /* Build start command */                                               
                                                                         
              CHGVAR     VAR(&CMD) VALUE('cd +                           
                           /QIBM/ProdData/WebASAdv/bin;wscp -c +         
                           "ApplicationServer' *BCAT &ACTION *BCAT ' +   
                           /Node:' *TCAT &NODE *TCAT +                   
                           '/ApplicationServer:' *TCAT &SERVER *TCAT +   
                          '/"')         
                                        
/* Start/Stop server */                 
                                        
             QSH        CMD(&CMD)       
                                        
             ENDPGM       

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Ask your Web development questions--or help out your peers by answering them--in our live discussion forums.

The Best Web Links: tips, tutorials and more.

Check out this live Q&A with Dave Slater and Jim Mason, How to best get started with WebSphere Development Tools.

This was first published in June 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.