Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: timeout problem in ssh sessions
- X-seq: zsh-users 12585
- From: Andy Spiegl <zsh.Andy@xxxxxxxxx>
- To: ZSH User List <zsh-users@xxxxxxxxxx>
- Subject: Re: timeout problem in ssh sessions
- Date: Fri, 15 Feb 2008 23:18:34 +0100
- In-reply-to: <080215123047.ZM29728@xxxxxxxxxxxxxxxxxxxxxx>
- Kreccount: 1
- Mail-followup-to: ZSH User List <zsh-users@xxxxxxxxxx>
- 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>
On 2008-02-15, 12:30, Bart Schaefer wrote:
> Some suggestions follow.
Coooool! Thanks a lot.
I didn't realize I wasted so much CPU and lines of code.
> } ps -eo user,pid,ppid,s,cpu,pmem,rss,vsize,bsdstart,etime,bsdtime,cmd | /bin/grep -v "etime,bsdtime,cmd" | /bin/grep -iE "(^USER|$$)" | /bin/grep -v "grep -iE"
>
> Why do you need ignore-case in that grep?
Just a copy&paste error :-(
I copied from a function in my .zsh/alias that I use regularily:
alias psl='ps -eo user,pid,ppid,s,cpu,pmem,rss,vsize,bsdstart,etime,bsdtime,cmd --sort user,pid | /bin/grep -v "etime,bsdtime,cmd"'
look () { psl | /bin/grep -iE "(^USER|$*)" | /bin/grep -v "grep -iE" }
There I am searching case-insensitively because I also like to search for
process names.
> Better still, since you're about to do the same ps|grep on the PPID:
>
> 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?
> } echo -n "Still open file descriptors: "
> } perl -e 'print join(" ", grep { -t $_ } 0..63)."\n"'
> } echo ""
>
> 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?
> } if whence xsel > /dev/null 2>&1; then
>
> No need for this test: If it's not in the ps output, you're not going to
> do anything with it, and if it is in the ps output, it must exist, right?
Right. I wanted to avoid the extra "ps" on machines where xsel doesn't
exist. But your version is a lot smarter.
Thank you again!
Andy.
--
"JAVA truly is the great equalizing software.
It has reduced all computers to mediocrity and buggyness." -- NASA
Messages sorted by:
Reverse Date,
Date,
Thread,
Author