Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: timeout problem in ssh sessions
- X-seq: zsh-users 12587
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: ZSH User List <zsh-users@xxxxxxxxxx>
- Subject: Re: timeout problem in ssh sessions
- Date: Fri, 15 Feb 2008 19:26:16 -0800
- In-reply-to: <20080215221834.GA23684@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080212232947.GA13793@xxxxxxxxx> <080212200708.ZM20711@xxxxxxxxxxxxxxxxxxxxxx> <20080213134200.GB31852@xxxxxxxxx> <200802131349.m1DDnXRF004831@xxxxxxxxxxxxxx> <27b8b8a0802130621x47568c7fo304848d02a1c6e76@xxxxxxxxxxxxxx> <20080213143803.GI619@xxxxxxxxxxxxxxxxxxx> <20080214125415.GC31852@xxxxxxxxx> <20080214180818.GO619@xxxxxxxxxxxxxxxxxxx> <20080215103220.GF31852@xxxxxxxxx> <080215123047.ZM29728@xxxxxxxxxxxxxxxxxxxxxx> <20080215221834.GA23684@xxxxxxxxx>
On Feb 15, 11:18pm, Andy Spiegl wrote:
}
} On 2008-02-15, 12:30, Bart Schaefer wrote:
}
} > ps="$(ps -eo user,pid,ppid,s,cpu,pmem,rss,vsize,bsdstart,etime,bsdtime,cmd)"
} Wonderful! To avoid that $ps contains the ps process itself I combined
} your two suggestions:
} ps="$(/bin/grep -v 'etime,bsdtime,cmd' =(ps -eo user,pid,ppid,s,cpu,pmem,rss,vsize,bsdstart,etime,bsdtime,cmd))"
}
} Is that ok / efficient?
There's no particular problem with it but I think it's unnecessary given
the way you're filtering the output later. The "ps" command is a child
of the subshell $(...), not of the login shell, so it will match neither
the grep for $$ nor the grep for $PPID (nor for xsel, obviously).
} > That's only telling you which descriptors are still connected to the tty,
} > not which ones are open, so you'll miss X connections and the like.
} Oh, too bad. Actually I _do_ want to see X connections and the like
} Is there a way to achieve this?
You can load the zsh/stat module and use
for fd in {0..63}; zstat -f $fd ...
There's the additional complication that the zstat builtin is called
"stat" in most versions of zsh so you have to account for that if you
want to be portable.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author