on 10-03-2004 8:45 AM
I want to script certain things in Visual Administrator, ConfigTool and start and stop the engine through script.
The things I like to control are things like adding a JDBC connection to the JDBC Connector (in VAdmin), adding a Java parameter to the server (in CTool) and others.
Is there a way to do this?
Can anyone point out a document or expert on this?
Thanks a lot,
Nir Arazi
Hi Iavor.
Thanks for the useful information you gave me.
Just before I grant you with the points you deserve, please answer some questions...
First of all, I cannot run the ADD DBPOOL command on my server. It gives me this response: "There aren't commands from DBPOOL group in the CommandContext". What should I do to get this running?
Second, you said I can write a script and put it in the server folder. Which folder is that?? C:\usr\sap\J2E\JC00\j2ee\cluster\server0 ?? a folder inside this ??
And how should I run this? from the root dir in telnet? should I browse to a different location?
Another thing I want to accomplish is to add a Java parameter to the server (I usually do this through the ConfigTool, I click on my instance, change the tab in the right side to Server, and add a line in the text box). Do you know if I can do this by script as well?
Again, Thank you!
Nir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Nir,
Regarding the DBPOOL if I understand you correctly,
open telnet and type add
it should give you all the available group commands
make sure you jump to the server. The default is that you are under the dispatcher which deos not contain the DBPool command and this is probably why you got the error message.
regarding how to run a script:
under the folder :
D:\usr\sap\(instance)\SYS\profile you can find a script
called START_JCOO_(host name).
This script is the one that runs when you
invoke the startup framework and there you
can place some scripts to run
By the way, where are you located?
Regards,
Udi
Hi Nir,
Sorry for the late reply - I hope it will still be of value for you (I don't care about the points - 10x is enough :).
About 1 - 10x to Udi you already know the answer - you have forgotten to jump to the server - Note 531293 described how to get the access to the server console (valid also for 6.40).
About 2 - Once having access to the server console you can invoke various commands from the added groups -
MAN
will give you a list of currently available
ADD
will give you a list of what you can use in addition
What you can use besides the commands provided with the Engine is scripts you write yourself.
Scripts are files in the server directory (server0 if you have a single) to which you have jumped. So it is good to have the script distributed to all serverX directories (directly in serverX, not in any subdir of it)
These scripts have the .scr extension and Windows (wrongly) tries to map them as screensavers
In fact they are collection of shell commands that are
supposed to be invoked in a group. You can actually write pretty sophisticated constructs using the shell language - there is if , for etc, but I doubt you will ever need that (At least it was always easier for me to hack a Java class file as command into the shell service rather than tackle with yet another language).
sample script:
#lists all applications in stopped status
add deploy
list_app | grep STOPPED
About 3 - How to run it :
telnet localhost 50308
Administrator
<mypass>
jump 0
run myscript
The output is : sap.com/tcwdeptests STOPPED! Server 0 3_29742
About 4 - it depends. Normally not. In any case not from the runtime of the Engine (and the files with .scr extension)
When the Engine starts it bootstraps its parameters from the DB and fills instance.properties. Later the data in instance.properties is used from jcontrol to start the jlaunch (JVM) processes. Hence if you switch off bootstrap and modify instance.properties and start the Engine (all that in an OS script) we can assume this task is
possible. Otherwise - not.
However as this is a very dangerous activity - you might forget to return the state back to what it used to be and patch/upgrade will fail because data needs to be taken from database - I believe the option of using the configtool is much better.
Hope this helps a bit
Best Regards: Iavor
Sorry for reactivating this old thread. I had the same problem as Nir and I wrote a little Perl script. This script automatic login over telnet to your SAP J2EE engine and can run any command. In the code listing below I restart a application. Maybe this is useful for you and all people who will find this thread over the search. It will work under Windows and *nix. Change the first line to your Perl interpreter.
[code]
#!C:\Perl\bin\perl.exe
######################################################
#
Nils Knieling; Mittwoch, 15. November 2006 08:54:12
#
Do something automatic, like stopping and starting
of a application.
#
######################################################
use Net::Telnet;
use strict;
USER VARIABLES START HERE ######
Your SAP J2EE Engine Host
my $host = 'sapdbesh';
SAP Telnet Port 5<SID>08
my $port = '54508';
Login
my $user = 'espadm';
JUMP to Server 0
my $jump = 'jump 0';
Application
my $app = 'sap.com/crm.b2c';
What should this script do?
my @dothis = (
'version',
'info',
'add deploy',
"stop_app $app",
"start_app $app",
);
Print telnet commands and output 0 = No | 1 = Yes
my $echo = '1';
USER VARIABLES END HERE ######
my @output = ();
my $telnet = new Net::Telnet ( Timeout=>10, Port => $port, Errmode=>'die');
print "\n\Uopen telnet connection: $user\@$host:$port\n\n" unless ($echo == '0');
print "Password for user \"$user\"? (The password will show as clear text)\n" unless ($echo == '0');
my $password = <STDIN>; # You can enter the password here
chomp($password);
Open connection
See SAP Note: 531293
$telnet->open($host);
$telnet->waitfor('/login: /i');
print "\n\Usend login\n" unless ($echo == '0');
$telnet->print("$user");
$telnet->waitfor('/password: /i');
print "\n\Usend password\n" unless ($echo == '0');
$telnet->print($password);
print "\n\Ulogin ok !\n\n" unless ($echo == '0');
$telnet->waitfor('/\>/i');
$telnet->print("$jump");
@output = $telnet->waitfor('/\>\>/i');
for (@output) {
print "$_\n" unless ($echo == '0');
}
JUST DO IT [tm]
for (@dothis) {
$telnet->print("$_");
@output = $telnet->waitfor('/\>/i');
for (@output) {
print "$_\n" unless ($echo == '0');
}
}
print "\n\Uclose connection\n" unless ($echo == '0');
$telnet->print("exit");
unless ($echo == '0') {
print "\n\Ufine\n\n\n";
my $end = <STDIN>;
}
[/code]
Regards from Hamburg Germany
-- Nils
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Iavor and Udi.
Thanks a lot for your help, and sorry about the delay of my response.
Your answers were very helpful though they did not fully solved the whole task I wanted to do.
I guess I'll post a new message when this becomes critical to us, specifying the remaining issues.
In the meantime, thanks a lot guys!
and Udi - I'm located in Tefen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nir,
For start and stop of the Engine - check Note 748713.
in the attached pdf there is a script for stopping through the jcmon:
#!/bin/csh
set SAPSYSTEMNAME= <SID>
set SAPSYSTEM= <##>
switch ( `uname` )
case "HP-UX":
setenv SHLIB_PATH /usr/sap/$/j2ee/j2ee_$/os_libs setenv LD_PRELOAD libjvm.sl breaksw case "AIX": setenv LIBPATH /usr/sap/$/j2ee/j2ee_$/os_libs breaksw case "Linux": case "SunOS": setenv LD_LIBRARY_PATH /usr/sap/$/j2ee/j2ee_$/os_libs
breaksw
endsw
cd /usr/sap/$/j2ee/j2ee_$/os_libs ./jcmon pf=/usr/sap/$/global/profile/jcontrol_$.pfl > jcmon.out << EOT
20
2
y
0
0
EOT
There are however issues with input redirection on Windows so be careful.
(The Note is for 6.20 but principle is the same).
For the automation of the JDBC connector creation - check the shell command reference at :
You can write the commands in a text file (myscript.scr), put it into
the server directory and then having jumped to the server from telnet, invoke the script :
run myscript
Full automated telnet , jump and invocation of the script I haven't tried, but I hope the above helps a bit.
Best Regards: Iavor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.