Sponsored Content
Top Forums Shell Programming and Scripting running multiple command in same line Post 302339900 by gubbu on Friday 31st of July 2009 05:20:44 PM
Old 07-31-2009
running multiple command in same line

I have 5 hosts and each host as 3 java process .I have one machine which has ssh keys so it can login without any passwords etc to all the machines.

How can I find out say jstack or some command so it goes to each machine and run the command . For example machine 1 has 3 java process and they all have different process ids . I want to run " jstack <pid> " on all machines .

I tried something like

for i in 1 2 3 ; do echo "running jstack"; ssh -q host1 pgrep java ; echo ""; done

I can get the process for each machine but not sure how to run "jstack pid> based on pid

thanks in advance
Joe
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

running multiple rsh command in a script

hi scripting experts, juz wondering if it's possible to have multiple rsh command in a single script? :confused: ie: rsh -l <username> "<command>" rsh -l <username> "<command>" thanks. regards, wee :) (0 Replies)
Discussion started by: lweegp
0 Replies

2. Shell Programming and Scripting

Running a command on multiple selected files in nautilus script

I am trying to make a script to convert drg files to wav and so far i have this #!/bin/bash drg2sbg "$*" -o "$*".sbg sbagen -Wo "/home/nick/Desktop/I-Doser Wave Files/"$*"" "$*".sbg rm "$*".sbg cd "/home/nick/Desktop/I-Doser Wave Files" rename 's/\.drg$/\.wav/' *.drg exit the drg2sbg and... (2 Replies)
Discussion started by: Nickbowlingdude
2 Replies

3. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

4. Shell Programming and Scripting

running multiple command in a single line

Hi Can we run the linux command and per script in a single command $ cd /usr/local/adm/ ;ctsv scmtest_qabuild ;cspec.pl scmtest This is a combination of linux and clearcase command and last one is perl script with argument. I can see the first and 2nd coomand is executing but last... (6 Replies)
Discussion started by: anuragpgtgerman
6 Replies

5. Shell Programming and Scripting

Logging in to multiple Linux servers and running the command.

Hi, I am trying to write a script to run a command on multiple linux based servers and get the o/p. I am using ssh to login. It is a celerra box and EMC NAS product. I am able login but i am not able to run nas command nas_pool -size -all the NAS server. I am getting the following error. ... (2 Replies)
Discussion started by: jpkumar10
2 Replies

6. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

7. Shell Programming and Scripting

Running a command for multiple folders at once

Hi I have folders 1 to 24 (24 folders in total) and inside those folders I have the same file names. I have a command that I want to run but rather than do it individually I was wondering if there is a command to run them all at once. Thanks Phil (3 Replies)
Discussion started by: phil_heath
3 Replies

8. Shell Programming and Scripting

Issue with running multiple commands withing su command

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user and expect to do the following things A. Source the environment variables for BATGPRD Database (the file used for sourcing is shown below after the script) B. Shutdown the DB from sqlplus -- The... (13 Replies)
Discussion started by: omega3
13 Replies

9. Shell Programming and Scripting

Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?

I am looking for help in processing of those options: '-n' or '-p' I understand what they do and how to use them. But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.) I did try it and -n works on 2 files. Question is: - is it possible to... (6 Replies)
Discussion started by: alex_5161
6 Replies

10. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies
java-functions(7)						RPM Java packaging						 java-functions(7)

NAME
java-functions - Functions library for Java applications. Written for the JPackage Project <http://www.jpackage.org/>: SYNOPSIS
set_jvm() Set the java virtual machine. Use a JAVA_HOME if defined, or try to find it from java command set_classpath() Set the classpath - this functions requires a valid JAVA_HOME, JAVACMD, and JAVA_LIBDIR. JARs could be specified as an argument, or via ADDITIONAL_JARS variable. set_javacmd() set the JAVACMD variable. Options should be passed via JAVACMD_OPTS variable. set_flags() set FLAGS variable. They could be specified as an argument, or via ADDITIONAL_FLAGS variable. set_options() set OPTIONS variable. They could be specified as an argument, or via ADDITIONAL_OPTIONS variable. run() run the application. It executed a following command. If VERBOSE is defined, then it prints the command to stdout. exec $JAVACMD $FLAGS -classpath $CLASSPATH $OPTIONS $MAIN_CLASS "$@" set_jvm_dirs() set JVM-related directories (JVM_LIBDIR, JAVA_VERSION, JAVAVER_LIBDIR and JAVAVER_JNIDIR variables). Requires a correct JAVA_LIBDIR, JAVA_HOME and JAVA_CMD. link_jar_repository() links a jar repository. Options could be found in build-jar-repository(1) find_jar() finds a specific extention (jar or directory). Requires a correct JAVA_LIBDIR, JAVAVER_LIBDIR and JVM_LIBDIR. Used by find-jar(1) com- mand. do_find_jar() core routine used by find_jar() check_java_env() checks java environment - the JAVA_HOME, JAVACMD, JAVA_LIBDIR, JNI_LIBDIR variables. DESCRIPTION
This is a library of generic shell functions which should be used on jpackage.org compatible distributions. FILES
/use/share/java-utils/java-functions shell script functions library for Java applications /etc/java/java.conf system-wide Java configuration file ~/.java/java.conf user's Java configuration SEE ALSO
Regular Manual Pages build-jar-repository(1) find-jar(1) java.conf(5) jpackage-utils(7) AUTHORS
Guillaume Rousse <guillomovitch@sourceforge.net> Ville Skytta <scop at jpackage.org> David Walluck <david@jpackage.org> Nicolas Mailhot <Nicolas.Mailhot at laPoste.net> REPORTING BUGS
Report bugs using JPackage Bugzilla (http://www.jpackage.org/bugzilla/) jpackage-utils 1.7.5 February 2009 java-functions(7)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy