Sponsored Content
Top Forums Shell Programming and Scripting shell script to collect information from current and remote unix boxes Post 302595603 by amir07 on Friday 3rd of February 2012 03:00:49 PM
Old 02-03-2012
As I mentioned passwordless ssh already in place.
When I enter : sudo su -
I can ssh to any boxes I like.
I need help to add sudo su - logic in the script for each boxes.
Code:
for h in AIXMC01 AIXMC02 AIXMC03 AIXMC04
do
  ssh $h lsattr -Elsys0 | awk -v h=$h '
BEGIN { print "Hostname Modelname SerialID" }
$1=="systemid"{s=$2}
$1=="modelname"{m=$2}
END {print h,m,s}'
done



Thanks,

---------- Post updated at 03:00 PM ---------- Previous update was at 02:45 PM ----------

the above script works fine when I logged as a root. the only problem I have
I dont want the heading for each boxes. As you can see "Hostname Modelname SerialID
" is repeating
Code:
Hostname   Modelname      SerialID 
AIXMC01    IBM,7026-B80   IBM,0110BBA1F
Hostname   Modelname      SerialID
AIXMC02    IBM,7026-H50   IBM,0110BBA56
Hostname   Modelname      SerialID
AIXMC03    IBM,7026-H50   IBM,0110BBARR
Hostname   Modelname      SerialID
AIXMC04    IBM,7026-B80   IBM,0110BBA43


Last edited by Franklin52; 02-04-2012 at 02:16 PM.. Reason: Please use code tags for data and code samples, thank you
 

9 More Discussions You Might Find Interesting

1. Programming

text boxes, radio buttons , check boxes in c++ on unix

Hi ! Please tell me how to get radio buttons, text boxes , check boxes , option buttons , pull down menus in C++ on Unix. I think it would be done using curses.h ..but that's all i know. TIA, Devyani. (3 Replies)
Discussion started by: devy8
3 Replies

2. Solaris

Planning for DR, I have to collect information

Dear All, We are going for Disaster Recovery project, the vendor asked for more details about how much is the daily data changes only. using sar / iostat can any one help me to collect this ?! Note: only I need the changed data size not the daily increasing data. this is to know how much... (1 Reply)
Discussion started by: adel8483
1 Replies

3. Shell Programming and Scripting

How can my unix shell script automatically connect to remote host?

How can my unix shell script automatically connect to remote host? Assume that there is a remote host called "rhost". When I connect to that host i give the command "telnet rhost". It then asks me for my id and password. Once i give it connects there. I want to automate these steps. I want... (8 Replies)
Discussion started by: digdarshan
8 Replies

4. UNIX for Dummies Questions & Answers

Enable a shell to collect data from unix, return to windows

hi I am very new to UNIX. I need to retrieve data from a unix system and store it and display as output on a windows system. Initiation of procedure is through JAVASCRIPT-based buttons on a HTML page. This should cause a set of commands to run which colllect data from a unix based server and... (1 Reply)
Discussion started by: rossalyn_maxter
1 Replies

5. Shell Programming and Scripting

Collect information from switches

Hi All , In my environment we have 12 SAN switches .Culd u pls help me for below queries . would like to telnet to all switches and collect information in daily basis with "switchstatus" command and store the output under /tmp/ folder on systemA . To keep passwords of 12switches in a... (1 Reply)
Discussion started by: chinni-script
1 Replies

6. Shell Programming and Scripting

script to collect all db information

hi all I am looking for shell script ,by which i need to gather all the DB information in Sybase server . Thanks in advance :) (3 Replies)
Discussion started by: mvsramarao
3 Replies

7. UNIX for Dummies Questions & Answers

Shell script to collect inbound connections

Hi Kindly provide me shell script on server to collect inbound connections, using port number on Linux. (4 Replies)
Discussion started by: adminhelp
4 Replies

8. Shell Programming and Scripting

Triggering remote UNIX shell script from Remote desktop

I m trying to run a batch script in remote desktop which executes unix commands on the unix server...the problem is i wnt the output in HTML format.so in my batch script i m giving the cmd like ssh hostname path ksh HC_Report.ksh>out.html ...but it generates the HTML file in remote desktop .i... (2 Replies)
Discussion started by: navsan
2 Replies

9. SuSE

How to filter SYSLOG data to collect meaningful information only?

Dear users, SUSE 10 sp3 and SUSE 11. I made configuration changes in '/etc/syslog-ng/syslog-ng.conf' to move SYSLOG content to LogRhythm. This is what I changed in the file. Un-comment out the following lines #Enable this and admop IP to send log messages to... (10 Replies)
Discussion started by: JDBA
10 Replies
FENCE_AGENT(8)						      System Manager's Manual						    FENCE_AGENT(8)

NAME
fence_bladecenter - Fence agent for IBM BladeCenter DESCRIPTION
fence_bladecenter is an I/O Fencing agent which can be used with IBM Bladecenters with recent enough firmware that includes telnet support. It logs into a Brocade chasis via telnet or ssh and uses the command line interface to power on and off blades. fence_bladecenter accepts options on the command line as well as from stdin. Fenced sends parameters through stdin when it execs the agent. fence_bladecenter can be run by itself with command line options. This is useful for testing and for turning outlets on or off from scripts. Vendor URL: http://www.ibm.com PARAMETERS
-a, --ip=[ip] IP Address or Hostname This parameter is always required. -l, --username=[name] Login Name This parameter is always required. -p, --password=[password] Login password or passphrase -c, --command-prompt=[prompt] Force Python regex for command prompt (Default Value: ['system>']) -x, --ssh SSH connection -n, --plug=[id] Physical plug number, name of virtual machine or UUID This parameter is always required. -u, --ipport=[port] TCP/UDP port to use (default 23, 22 if --ssh TCP/UDP port to use for connection with device (Default Value: 23) -4, --inet4-only Forces agent to use IPv4 addresses only -6, --inet6-only Forces agent to use IPv6 addresses only -S, --password-script=[script] Script to retrieve password -k, --identity-file=[filename] Identity file for ssh --ssh-options=[options] SSH options to use -o, --action=[action] Fencing Action (Default Value: reboot) -v, --verbose Verbose mode -D, --debug-file=[debugfile] Write debug information to given file -V, --version Display version information and exit -h, --help Display help and exit -C, --separator=[char] Separator for CSV created by operation list (Default Value: ,) --missing-as-off Missing port returns OFF instead of failure --power-timeout=[seconds] Test X seconds for status change after ON/OFF (Default Value: 20) --shell-timeout=[seconds] Wait X seconds for cmd prompt after issuing command (Default Value: 3) --login-timeout=[seconds] Wait X seconds for cmd prompt after login (Default Value: 5) --power-wait=[seconds] Wait X seconds after issuing ON/OFF (Default Value: 10) --delay=[seconds] Wait X seconds before fencing is started (Default Value: 0) --retry-on=[attempts] Count of attempts to retry power on (Default Value: 1) ACTIONS
on Power on machine. off Power off machine. reboot Reboot machine. status This returns the status of the plug/virtual machine. list List available plugs with aliases/virtual machines if there is support for more then one device. Returns N/A otherwise. monitor Check the health of fence device metadata Display the XML metadata describing this resource. STDIN PARAMETERS
ipaddr IP Address or Hostname This parameter is always required. login Login Name This parameter is always required. passwd Login password or passphrase cmd_prompt Force Python regex for command prompt (Default Value: ['system>']) secure SSH connection port Physical plug number, name of virtual machine or UUID This parameter is always required. ipport TCP/UDP port to use for connection with device (Default Value: 23) inet4_only Forces agent to use IPv4 addresses only inet6_only Forces agent to use IPv6 addresses only passwd_script Script to retrieve password identity_file Identity file for ssh ssh_options SSH options to use action Fencing Action (Default Value: reboot) verbose Verbose mode debug Write debug information to given file version Display version information and exit help Display help and exit separator Separator for CSV created by operation list (Default Value: ,) missing_as_off Missing port returns OFF instead of failure power_timeout Test X seconds for status change after ON/OFF (Default Value: 20) shell_timeout Wait X seconds for cmd prompt after issuing command (Default Value: 3) login_timeout Wait X seconds for cmd prompt after login (Default Value: 5) power_wait Wait X seconds after issuing ON/OFF (Default Value: 10) delay Wait X seconds before fencing is started (Default Value: 0) retry_on Count of attempts to retry power on (Default Value: 1) fence_bladecenter (Fence Agent) 2009-10-20 FENCE_AGENT(8)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy