From: qwx@sciops.net
To: 9front@9front.org
Subject: Re: [9front] lstk script
Date: Mon, 14 Aug 2023 11:21:07 +0200 [thread overview]
Message-ID: <445F20688F264CE4E20F849E164FA196@wopr.sciops.net> (raw)
In-Reply-To: <6FFAA10E6F8E59B921318DC1C6F7959A@prosimetrum.com>
On Mon Aug 14 10:48:52 +0200 2023, umbraticus@prosimetrum.com wrote:
> The lstk script recently committed is a handy tool.
> I humbly submit the version which I have been using.
> If there are multiple broken processes it prints them
> in a sendable format instead of just picking most recent.
>
> #!/bin/rc
> rfork e
> p = `{ps | awk '/Broken/{print $2 " "$7}'}
> if(~ $#p 2){
> echo 'echo ''lstk()'' | acid' $p(1) '#' $p(2)
> echo 'lstk()' | acid $p(1)
> exit $status
> }
> fn list{
> while(! ~ $#* 0){
> echo 'echo ''lstk()'' | acid' $1 '#' $2
> shift; shift
> }
> }
> list $p
Thanks umbraticus and Ori, here's also a stupidly pimped out version
that either looks up the last Broken process, or matches a given
pattern (name, pid or group, etc.), or prints matching procs and
exits. Printing all in sendable format is a better idea there though.
I suggest we pull whatever seems useful from both scripts and any
other attempts, and that we also add one or more convenience plumb
rules such as (also stolen from Ori):
type is text
data matches '[^ ]+ ([0-9]+): suicide:.*'
plumb to none
plumb start window lstk $1
Cheers,
qwx
#!/bin/rc
rfork n
print=()
if(~ $1 -p){
print=1
shift
}
if(~ $#* 0)
p=Broken
if not{
p=$1
shift
}
ps -a | grep $p | grep -v 'grep '^$p
p=`{ps | awk -v 'P='^$p '$7 == P || $2 == P || $6 == P{ p=$2 } END{ print p }'}
if(~ $#p 0){
echo no proc $p >[1=2]
exit noproctohand
}
echo scroll >/mnt/wsys/wctl
if(! ~ $#print 0){
echo lstk'()' | acid -lthread -lpool $p
echo acid -lthread -lpool $* $p
}
if not{
{echo lstk'()'; cat} | acid -q -lthread -lpool $* $p
}
next prev parent reply other threads:[~2023-08-14 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 8:50 umbraticus
2023-08-14 9:21 ` qwx [this message]
2023-08-14 15:15 ` Stanley Lieber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=445F20688F264CE4E20F849E164FA196@wopr.sciops.net \
--to=qwx@sciops.net \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).