From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9897 invoked from network); 14 Aug 2023 15:20:36 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 14 Aug 2023 15:20:36 -0000 Received: from gaff.inri.net ([168.235.71.243]) by 9front; Mon Aug 14 11:15:20 -0400 2023 Received: from [127.0.0.1] ([104.59.85.219]) by gaff; Mon Aug 14 11:15:20 -0400 2023 Date: Mon, 14 Aug 2023 11:15:19 -0400 From: Stanley Lieber To: 9front@9front.org In-Reply-To: <445F20688F264CE4E20F849E164FA196@wopr.sciops.net> References: <445F20688F264CE4E20F849E164FA196@wopr.sciops.net> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: shader property CSS optimizer Subject: Re: [9front] lstk script Reply-To: 9front@9front.org Precedence: bulk On August 14, 2023 5:21:07 AM EDT, qwx@sciops=2Enet wrote: >On Mon Aug 14 10:48:52 +0200 2023, umbraticus@prosimetrum=2Ecom wrote: >> The lstk script recently committed is a handy tool=2E >> I humbly submit the version which I have been using=2E >> If there are multiple broken processes it prints them >> in a sendable format instead of just picking most recent=2E >>=20 >> #!/bin/rc >> rfork e >> p =3D `{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=2E), or prints matching procs and >exits=2E Printing all in sendable format is a better idea there though= =2E >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:=2E*' >plumb to none >plumb start window lstk $1 > >Cheers, >qwx > > >#!/bin/rc >rfork n >print=3D() >if(~ $1 -p){ > print=3D1 > shift >} >if(~ $#* 0) > p=3DBroken >if not{ > p=3D$1 > shift >} >ps -a | grep $p | grep -v 'grep '^$p >p=3D`{ps | awk -v 'P=3D'^$p '$7 =3D=3D P || $2 =3D=3D P || $6 =3D=3D P{ p= =3D$2 } END{ print p }'} >if(~ $#p 0){ > echo no proc $p >[1=3D2] > 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=2E sl