If I execute below code I am able to get string from column8 and column10 about a process.
servers
But when I try to execute below script to execute same command on multiple servers, I am getting "0"s instead of column8 and column10. I think block of lines execution syntax does not like --> $8" "$10 in awk.
How can I print output from each server in this format?
Moderator's Comments:
Please use CODE tags, not ICODE tags
Last edited by Scrutinizer; 06-04-2015 at 07:34 PM..
Reason: Additional code tags; changed code tags to code tags
I suppose the here-document goes to the "sudo"-command, not the "ssh"-command.
Anyways, the command as you wrote it must be wrong (or, to be precise, overly complicated). Whenever a "grep" is piped into another "grep" and/or "awk" then something is to be done:
should do the same.
Btw. i suppose the "sudo" is there for the wrong purpose, because i doubt that only "root" is allowed to do a "ssh". You probably want to connect as "root", which you can achieve in two ways:
On a system where the ps -ef output conforms to POSIX standard requirements, the command:
would print the command name and the 2nd argument passed to that command for any commands that contained the strings rotate and config, but that doesn't seem to be what you're showing us. Also note that the standards allow the command and its arguments to be truncated to an implementation-defined line length limit. (And, this could cause the strings you're looking for to be dropped from the ps output you're processing.) Your version of ps may provide options to set various line length limits to control that truncation. What output do you get from the command:
What are you expecting to find in fields 8 and 10 in the ps output?
Don, I am trying to find inventory of what OHS(oracle http server) instances are up and running on each server. We have around 200 ohs instances on 20 servers. I can get these details on each server using awk, please check my initial post. But same command does not work over "ssh" using $> ssh command <<EOF ... EOF syntax.
I think this syntax treats $ and "" differently than executing directly on the server.. How can get same result over SSH also?
Hi All ,
I'm running a script abc.sh in server "host1" shown as below :
#! /bin/bash
sh stop.sh
ssh user@$host2 "/home/user/prod_work/xyz.sh;
sh start.sh
The problem I am facing is , the control is not passed to host1 after executing the script "xyz.sh" in host2 .
... (12 Replies)
Hi,
There's a shell script by name "download", which has been created as user "mgr" and that script needs to executed as user "dev".
I tried giving privileges 701 on the script download.
But it's throwing the error message
bin]$ ./download
/bin/bash: ./download: Permission denied
... (6 Replies)
How to see the output from remote server during execution of a script ?
I am executing a script (ls) from machine 1 but the o/p should be displayed in machine 2. Can I achieve this ?
Example:-
Machine 1:-
# ls
Machine 2:- (console)
file1 file2 file 3
dir1 dir2 (0 Replies)
Greetings, i'm currently having issues in successfully executing a script from one server to other, and i'm cracking my nut in understanding why. Let's get started with the default info:
Server A:
briozzo@A:/home/briozzo $ uname -a
HP-UX A B.11.31 U ia64 2787251109 unlimited-user license
... (3 Replies)
Hi gurus,
I have a requirement where I need to remotely run a perl script as another user.
Running the script locally as the required user is fine, however I need to su with the script due to filesystem permission issues. I do not want to update permissions on the remote server due to security... (5 Replies)
If a user execute commands remotely over ssh : $ ssh USERNAME@SERVER COMMANDSHow the SERVER administrator can log those COMMANDS executed in a "not a tty" session ?
I searched for my question and get the following suggestions:Anybody give help how to do this ? what the content of "/bin/bash "... (1 Reply)
does anyone know how can i execute a script which i locally run as " . /etc/local/host/src.srvr -D ."
need to execute above command in rexec command. if i put the command as it is it does not run. Sorry but i am naive in scripting. Thanks
rexec sgplqim -l vau -n '
' (0 Replies)
Hi all
I wrote a script to execute a script on several remote hosts, but somehow during the execution of the local script, ssh can't come back from the remote host, so that causes my local script hanging... I use the below command to do the job in the local script, any idea?
ssh... (12 Replies)
Hi all,
i am trying to remotely execute a script from a different server.
this is the code that i use :
#!bin/sh
pwd
(sleep 1 echo "username"
sleep 2 echo "pwd"
sleep 2 echo "cd /path/to/file"
if
then
echo "script1.sh"
echo "mailx -s "Task Executed"... (1 Reply)
I have a solaris9 x86 server using ssh as follows:
SSH Version Sun_SSH_1.0, protocol versions 1.5/2.0.
The remote server solaris9 sparc has exactly the same version ssh installed.
I am running a script on my server which includes the following command to run a script on the remote server:... (4 Replies)