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.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 30181 invoked from network); 14 Aug 2023 09:22:43 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 14 Aug 2023 09:22:43 -0000 Received: from wopr.sciops.net ([216.126.196.60]) by 9front; Mon Aug 14 05:21:14 -0400 2023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sciops.net; s=20210706; t=1692004841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=DHjFf6xI0q5VtbJAOvsFaBbsWOEJatku4fIW1e0jSH0=; b=yOmLPH0otN0Dgrd9nA0zcud3jANArk/EA0YJqdvPy0K6apKmlkZsvqrp3w4lHOH9KNFN2m 05c7uei96h6eZajjsiuZLF+GhN0znH4M4mnXjxHZzy7SXZY+1erZ7nJo5lXTixy6LC+uAf iWZJFsN9D7YgKWHzM36KfKUedDm0bHM= Received: by wopr.sciops.net (OpenSMTPD) with ESMTPSA id ab4d14e0 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for <9front@9front.org>; Mon, 14 Aug 2023 02:20:40 -0700 (PDT) Message-ID: <445F20688F264CE4E20F849E164FA196@wopr.sciops.net> Date: Mon, 14 Aug 2023 11:21:07 +0200 From: qwx@sciops.net To: 9front@9front.org In-Reply-To: <6FFAA10E6F8E59B921318DC1C6F7959A@prosimetrum.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: responsive lifecycle app XML over ActivityPub element element frontend Subject: Re: [9front] lstk script Reply-To: 9front@9front.org Precedence: bulk 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 }