From: Stanley Lieber <sl@stanleylieber.com>
To: 9front@9front.org
Subject: Re: [9front] lstk script
Date: Mon, 14 Aug 2023 11:15:19 -0400 [thread overview]
Message-ID: <FFEC6A7A-F8DB-43A1-B0E4-82ADC0B0ECB3@stanleylieber.com> (raw)
In-Reply-To: <445F20688F264CE4E20F849E164FA196@wopr.sciops.net>
On August 14, 2023 5:21:07 AM EDT, qwx@sciops.net wrote:
>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
>}
>
printing commands to pipe or send is very good.
sl
prev parent reply other threads:[~2023-08-14 15:20 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
2023-08-14 15:15 ` Stanley Lieber [this message]
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=FFEC6A7A-F8DB-43A1-B0E4-82ADC0B0ECB3@stanleylieber.com \
--to=sl@stanleylieber.com \
--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).