From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 297031382C5 for ; Fri, 5 Feb 2021 12:12:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B4DCE08F6; Fri, 5 Feb 2021 12:12:49 +0000 (UTC) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071092.outbound.protection.outlook.com [40.92.71.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E26A5E0817 for ; Fri, 5 Feb 2021 12:12:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOATPomsYVqy9mXZDo5Xv43g7GlUHp4MbOerTJ1/EDxhohrMqiipZpTxzUMg0oj1fdp1GbwftAk8Dl3wDagEgj3Uk23lhYZETViy4KcZsQ6izogjXcp4J8AGXt/2wFO9y0Fb3JmTtkjvIztNACg/tRt2JbU+HoIwyQyO+RiQXR7bK1DMojSE510jmqtgFFKsloqGpRqwat3Skx7KSY4eBuvO97V4UXaatrrDH5D9bvHx+PzI4wmDs1Ogjnu8FdauWWNYQ44ribjQIhObdmTHQEFYRung9xMURWhe293gYKQz58adM+aP/DeojfVh7TiQX7fMvR4E8H5lyfp3PF7cgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0F+aV5jJTur29aBgTjuyEWOGr/FlBRv5J5MI1F5XLbQ=; b=ezlQgnie8H/O6VHM7c8Cvce6+wlMXSc2/cApE4qDXVGTYzz3Mg2gBFLvmTzEIYbMAh+KlPtq4VM8yEEsQhVzL4h/eAh8r8CORUDE5NlDbzlFeX3pdzHj00c5oEX5Do572xgzv+4p86CVIOtlKJxy20IkAtfHzAn9+DuT5mLhiAY3Xx4fdj20PTf0OQQKnEIIk7B/z7p7MjMdVzR9vIopxjXEpFNjtPneNxhyKJFFuN1SjC7zBqN8hdi1stdIUprt/3rqRXNekVvT+DBTpqDR9xWxd4Fo55PeEVLtfloa0aL2oVTidDyz95/iECVq2wXMS0Xowa4kh5OiaF+vLLWIUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::4c) by VE1EUR03HT194.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::305) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Fri, 5 Feb 2021 12:12:47 +0000 Received: from AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:7e09::51) by VE1EUR03FT025.mail.protection.outlook.com (2a01:111:e400:7e09::74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Fri, 5 Feb 2021 12:12:47 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E2FFC09ADEB2FB1D3EF1221E9028B0EE36D12F92405BEEDF1A40A1298F98AE38;UpperCasedChecksum:665A3CE47D5D55B4F1434DF8F7BB933BC4C4464BB6C5867C1D8E3AA612E8F10D;SizeAsReceived:8724;Count:45 Received: from AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM ([fe80::9869:bf6b:2ddc:cb0a]) by AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM ([fe80::9869:bf6b:2ddc:cb0a%5]) with mapi id 15.20.3825.023; Fri, 5 Feb 2021 12:12:46 +0000 To: gentoo-user@lists.gentoo.org References: From: Ramon Fischer Subject: Re: [gentoo-user] HOWTO: Freezing/unfreezing (groups of) processes Message-ID: Date: Fri, 5 Feb 2021 13:12:45 +0100 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MPN9oiAQV3NC6M6brGY5qXXWC0xW5HtA0" X-TMN: [lIZDmHvT1dqR1D7CxewpuAVeSDecEg/LH8HzdPItOUiNjvOlWaX4qqhlyjMe/jx6] X-ClientProxiedBy: AM5PR0402CA0011.eurprd04.prod.outlook.com (2603:10a6:203:90::21) To AM6PR10MB2440.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4c::30) X-Microsoft-Original-Message-ID: <70bb8f98-a6e0-c030-de50-c62c145e7579@hotmail.de> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4dd6:2a23:0:e785:5af0:7b9a:b0a3] (2001:4dd6:2a23:0:e785:5af0:7b9a:b0a3) by AM5PR0402CA0011.eurprd04.prod.outlook.com (2603:10a6:203:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Fri, 5 Feb 2021 12:12:46 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 7f72e2e8-012c-4010-0c0f-08d8c9cf58f1 X-MS-TrafficTypeDiagnostic: VE1EUR03HT194: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0xPaAsVfix88/OybeG10BgJTDmHRsFN4/yI+H7X7QWM7g/vgGZ0qD6wLKQiMDUODSnPsGGRMHOnt2+M2gTBnvRkQutICZmsc+E5vPAMIIc7VmzaVQ1ENWhVzHYyh6pokRCUhHCV/MeZFHzC/iA68ENViCS0TEpwoDau8quiVD+Gsm63e8qQgMUId3XJZk6YIVdM13+52wHXNl5ohd59/bbRZ2CvGRy72cdY0Rb2kBbe4vlpLh+SaZ0h1IzyjHD5RUpAX/+RqRszlb1q1Um+h2g4TjVU6yH6cN6uo2RAhGW5p5eDOfG0hu5W/BBgqoVRvWcppF18+mOxy+ru00+y/gxfzjqX7WO1Xpyf1RKBEtXGYWQ7P1ssVQVmtqAtnQvAIjb0Hyqz2HHl6Zvs2s8vUZTAD1gbx2eIDASaL91Fzp4OHqkWtpX7olS1wCJpm1mIY X-MS-Exchange-AntiSpam-MessageData: +BBgRNoaEe4yCFMirpBwTxNYwqKbJY6kg6888LSGYu12vIOUoQKhQlIS8eQS4E8jQK8o4PgdX7tzxVeE+rkPX0MIEhLMOixgSpqtefRBlH0gL+F1ZepseD1/mldPT4ttUXq51SjyNYGiisvWVZs233wZ19Fhe8BBC0YNisiA1cxAbZpn7+ifp3IoGOv3HKIDPdm0mLeuI9w5SXDiQIpHTg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f72e2e8-012c-4010-0c0f-08d8c9cf58f1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2021 12:12:46.8656 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT194 X-Archives-Salt: 6e6520f5-1096-491b-a486-93ae805ebd47 X-Archives-Hash: 80b63ee8cbb1c6aa10c19fce462c6ad6 --MPN9oiAQV3NC6M6brGY5qXXWC0xW5HtA0 Content-Type: multipart/mixed; boundary="r45l8JotJE2NolzPrwBJrJtw2AUc2qiR5"; protected-headers="v1" From: Ramon Fischer To: gentoo-user@lists.gentoo.org Message-ID: <70bb8f98-a6e0-c030-de50-c62c145e7579@hotmail.de> Subject: Re: [gentoo-user] HOWTO: Freezing/unfreezing (groups of) processes References: In-Reply-To: --r45l8JotJE2NolzPrwBJrJtw2AUc2qiR5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US Awesome stuff! It might be unrelated, but I would like to mention a script[1] here,=20 which I have written in Bash to analyse process signals. It is called=20 "psig", which mimics some of the behaviour of Solaris' "psig" binary: $ psig 23024 PID: 23024 Name: chrome Queued: 0/63858 Signals caught: --------------- Signal 17: SIGCHLD Signal 15: SIGTERM Signal 2: SIGINT Signal 1: SIGHUP Hexadecimal:=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0= 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2= =A0 0 0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0 8=C2=A0=C2=A0=C2= =A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0= =C2=A0 4=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2= =A0=C2=A0 3 Binary:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0000=C2=A0 0000=C2=A0 000= 0=C2=A0 0000=C2=A0 0000=C2=A0 0000 0000=C2=A0 0001=C2=A0 1000=C2=A0 0000=C2=A0 0000=C2=A0 0001=C2=A0 0100=C2=A0 0000=C2=A0 0000=C2=A0 001= 1 Signals pending (process): -------------------------- No signals found. Signals pending (thread): ------------------------- No signals found. Signals blocked: ---------------- No signals found. Signals ignored: ---------------- Signal 13: SIGPIPE Hexadecimal:=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0= 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2= =A0 0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2= =A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0= =C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2= =A0=C2=A0 0 Binary:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0000=C2=A0 0000=C2=A0 000= 0=C2=A0 0000=C2=A0 0000=C2=A0 0000 0000=C2=A0 0000=C2=A0 0000=C2=A0 0000=C2=A0 0000=C2=A0 0000=C2=A0 0001=C2=A0 0000=C2=A0 0000=C2=A0 000= 0 -Ramon [1] https://github.com/keks24/psig On 05/02/2021 08:45, Walter Dnes wrote: > Thanks for all the help over the years fellow Gentoo'ers. Maybe I c= an > return the favour. So you've got a bunch of programs like Gnumeric or > QEMU or Pale Moon ( or Firefox or Chrome or Opera ) sessions open, that= > are chewing up cpu and ram. You need those resouces for another > program, but you don't want to shut those programs down and lose your > place. If the programs could be frozen, cpu usage would go away, and > memory could be swapped out. Here's a real-life example subset of a > "ps -ef" output on my system. Replace "palemoon" with "firefox" or > "chrome" or whatever browser you're using. > > waltdnes 4025 3173 0 Jan20 ? 01:54:21 /home/waltdnes/pm/palem= oon/palemoon -new-instance -p palemoon > waltdnes 7580 3173 4 Jan21 ? 17:45:11 /home/waltdnes/pm/palem= oon/palemoon -new-instance -p dslr > waltdnes 9813 3173 4 Jan21 ? 16:24:23 /home/waltdnes/pm/palem= oon/palemoon -new-instance -p wxforum > waltdnes 22455 3173 58 01:31 ? 00:08:29 /home/waltdnes/pm/palem= oon/palemoon -new-instance -p slashdot > waltdnes 22523 3173 0 01:31 ? 00:00:05 /home/waltdnes/pm/palem= oon/palemoon -new-instance -p youtube > waltdnes 22660 3173 12 01:45 ? 00:00:04 /usr/bin/gnumeric /home= /waltdnes/worldtemps/temperatures/temperatures.gnumeric > waltdnes 20346 20345 4 Jan28 ? 08:10:50 /usr/bin/qemu-system-x8= 6_64 -enable-kvm -runas waltdnes -cpu host -monitor vc -display gtk -driv= e file=3Darcac.img,format=3Draw -netdev user,id=3Dmynetwork -device e1000= ,netdev=3Dmynetwork -rtc base=3Dlocaltime,clock=3Dhost -m 1024 -name Arca= OS VM -vga std -parallel none > > You might want to RTFM on the "kill" command if you're skeptical. I= t > does a lot more than kill programs. "kill -L" will give you a nicely > formatted list of available signals. For this discussion we're > interested in just "SIGCONT" and "SIGSTOP" ( *NOT* "SIGSTP" ). If I > want to freeze the Slashdot session, I can run "kill -SIGSTOP 22455". T= o > unfreeze it, I can run "kill -SIGCONT 22455". You can "SIGSTOP" on a > pid multiple times consecutively without problems; ditto for "SIGCONT".= > > So far, so good, but running "ps -ef | grep whatever" and then > typing the kill -SIGSTOP/SIGCONT command on the correct pid is grunt > work, subject to typos. I've set up a couple of scripts in ~/bin to > stop/continue processes, or groups thereof. The following scripts do a= > "dumb grep" of "ps -ef" output, redirecting to /dev/shm/temp.txt. That= > file is then read, and the second element of each line is the pid, whic= h > is fed to the "kill" command. I store the scripts as ~/bin/pstop and > ~/bin/pcont. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D pstop (process s= top) script =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > #!/bin/bash > ps -ef | grep ${1} | grep -v "grep ${1}" | grep -v pstop > /dev/shm/tem= p.txt > while read > do > inputarray=3D(${REPLY}) > kill -SIGSTOP ${inputarray[1]} > done < /dev/shm/temp.txt > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D pcont (process continu= e) script =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > #!/bin/bash > ps -ef | grep ${1} | grep -v "grep ${1}" | grep -v pcont > /dev/shm/tem= p.txt > while read > do > inputarray=3D(${REPLY}) > kill -SIGCONT ${inputarray[1]} > done < /dev/shm/temp.txt > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > To stop all Pale Moon instances, execute "pstop palemoon". To stop > only the Slashdot session, run "pstop slashdot". Ditto for the pcont > command. I hope people find this useful. > --=20 GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF --r45l8JotJE2NolzPrwBJrJtw2AUc2qiR5-- --MPN9oiAQV3NC6M6brGY5qXXWC0xW5HtA0 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEWYOY2l9NpGQ4/c+HFVviZBPmmb8FAmAdNj0FAwAAAAAACgkQFVviZBPmmb8K Pg//Vo/9pPFtcCVeLj5zjoVOuag3sX6KzthQCUYzKrgK1mFIxWHFiqGThmH5yRsmIgZ5hOCp9gcR kxDj5br5nd7Bt4mRy9WcEaNNkiQE7Be16gsSu4x8jBtH0NpBGM0vPepboLyiMahyE+SEe+LRSz9X P5LBPLKdHjiGzdyqmgfn4+Tao9+B7Y+5VHWrZoVLg596BcA+63KzvbI2jlvSa0zheRy5CQwlVvof cf6Nh7t6JpSaLvzr5d5+29um4GASCW5gcJZq21BQ4YkEbaHQI3TZnaVpmYK+MFkH4LoUaVXvMvqL T+VO7tXRqwGMzMz6xaq/Bpf/4GWRatoRNg+FOKdwdAitoldV9WEzD224IuKk5ECEBlFf4BNyIplj TA7A3DDX3vQ100J8jET0QkSUlw7feV7EHFnrBUdgNi2TkkR53/9RjNGUGT1VjYko2K0Aw8vKH0UY 0gOnTTZut0StpUehG7WaXk3AwmeN9Q0YEN36V0GFFfz7uGemc5pHcrFHxrOI814IrXdxgcqfmNft +/f+XpLtDZa2nPm48Qp95EF+ul4MtRYzTNUQ/dmNi8+JfHp0zjxcS4LIbYxgNaIKQvqV1qVHWyum yUQxkWanUs/axy1TlO3pWHGMFepjm0VUC7gFOkZNB3WrAJO8+Wo+BrBUrc5OfwuqxH88X/Ffop6X oDA= =ULdN -----END PGP SIGNATURE----- --MPN9oiAQV3NC6M6brGY5qXXWC0xW5HtA0--