10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I read a file (iplist.txt) ine-by-line in a loop which has the list of all the server hostnames.
With each hostname read; I do ssh and fire multiple commands to gather information about that systemas shown below.
#!/bin/bash
while IFS='' read -r line || ]; do
echo "Text read from file:... (3 Replies)
Discussion started by: mohtashims
3 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement .
Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks .
We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies
3. AIX
Hi,
I am having a file like,
#cat file
Jun 19 13:08
Jun 19 13:08
Jun 19 13:08
Jun 19 13:14
when I run the below comamnd locally it will work fine,
IFS=$'\n'; for i in $(cat file) ;do echo "HI $i" ; done
And the output is,
HI Jun 19 13:08
HI Jun 19 13:08
HI Jun 19 13:08
HI... (1 Reply)
Discussion started by: sumanthupar
1 Replies
4. AIX
hello all,
i have an AIX6.1 machine and INFORMIX 11.7 database server.
i have a script to create users on 3 machines and also i need to grant this user access to a specific database. the script works and it does what i want it to do but the loop doesnt work. for example if i insert 10 lines in... (5 Replies)
Discussion started by: omonoiatis9
5 Replies
5. Shell Programming and Scripting
#!/bin/ksh
for SRV in imawasp01 \
imawasp02 \
imawasp03 \
imawasp04 \
imawasp05 \
imawasp06 \
imawasp07 \
imawasp08 \
imawasp09
do
print "${SRV}"
while read PASSLINE
do
SRVNAME=`echo ${PASSLINE} | awk -F\: '{print $1}'`
LASTLOGIN=`ssh ${SRV} lsuser ${SRVNAME} | tr '... (2 Replies)
Discussion started by: port43
2 Replies
6. Shell Programming and Scripting
I have a shell script, and its pretty much done, I decided to add a loop that ends or continues depending on user input. like "would you like to continue?" and if I hit y or yes it will run the loop again until I hit n or no and breaks out of the loop.
To be hones I didn't think I needed to add... (2 Replies)
Discussion started by: Demon_Jester
2 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I am facing an issue while trying to access a for loop variable inside ssh. Can anyone please help me with what this issue is, the following is the code that I have ->
IMPL_LOG_FOLDERS=(transaction_logs invalid_transaction_logs)
sshg3 ftp_id@boxname << EOS
for log_folder in... (5 Replies)
Discussion started by: anindyabecs
5 Replies
8. Shell Programming and Scripting
How do you do an ssh on a for statement. I have done ssh on individula lines of code before with no problems.
#!/usr/bin/ksh
cat server_list.txt | while read line
do
ssh $line "for i in `lslpp -l |grep tsm`
do
lslpp -Lc $i |grep -v State |tr ':' ',' |awk -F, '{print $2, "," ,... (4 Replies)
Discussion started by: din
4 Replies
9. Shell Programming and Scripting
Hi all,
I am trying to run a script which is expected to do:
on the remote machine,
There are two directories /export/home/abc1,/export/home/abc2
i am trying to do,
ssh SERVERNAME "for i in `ls -l /export/home/abc*|awk '{print $9}'`; do cd $i; ls -l; done"
But its not working ,iam... (11 Replies)
Discussion started by: Jartan
11 Replies
10. Shell Programming and Scripting
Hi
I use the following command to check if my_base is active or not :
active_db=`${LOCAL_BIN}/ssh -l ${my_user} ${my_service} "ps -ef | grep ora_smon | grep ${my_base} | sed -e \"s/ */ /g\" | cut -d'?' -f2 | cut -d' ' -f3 | cut -d'_' -f3"`
When I use a file listing databases to check them... (1 Reply)
Discussion started by: madmat
1 Replies
ptree(1) ptree(1)
NAME
ptree - print process trees
SYNOPSIS
/usr/bin/ptree [-a] [-c] [-z zone] [pid | user] ...
ptree prints the process trees containing the specified pids or users, with child processes indented from their respective parent pro-
cesses. An argument of all digits is taken to be a process-id, otherwise it is assumed to be a user login name. The default is all pro-
cesses.
The following options are supported:
-a All. Print all processes, including children of process 0.
-c Contracts. Print process contract memberships in addition to parent-child relationships. See process(4). This option
implies the -a option.
-z zone Zones. Print only processes in the specified zone. Each zone ID can be specified as either a zone name or a numerical zone
ID.
This option is only useful when executed in the global zone.
The following operands are supported:
pid Process-id or a list of process-ids. ptree also accepts /proc/nnn as a process-id, so the shell expansion /proc/* can be
used to specify all processes in the system.
user Username or list of usernames. Processes whose effective user IDs match those given are displayed.
Example 1: Using ptree
The following example prints the process tree (including children of process 0) for processes which match the command name ssh:
$ ptree -a `pgrep ssh`
1 /sbin/init
100909 /usr/lib/ssh/sshd
569150 /usr/lib/ssh/sshd
569157 /usr/lib/ssh/sshd
569159 -ksh
569171 bash
569173 /bin/ksh
569193 bash
The following exit values are returned:
0 Successful operation.
non-zero An error has occurred.
/proc/* process files
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|Interface Stability |See below. |
+-----------------------------+-----------------------------+
The human readable output is Unstable. The options are Evolving.
gcore(1), ldd(1), pargs(1), pgrep(1), pkill(1), plimit(1), pmap(1), preap(1), proc(1), ps(1), ppgsz(1), pwd(1), rlogin(1), time(1),
truss(1), wait(1), fcntl(2), fstat(2), setuid(2), dlopen(3C), signal.h(3HEAD), core(4), proc(4), process(4), attributes(5), zones(5)
11 Oct 2005 ptree(1)