From owner-freebsd-questions@FreeBSD.ORG Fri Nov 10 08:09:04 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 91BC216A417 for ; Fri, 10 Nov 2006 08:09:04 +0000 (UTC) (envelope-from nicky@valuecare.nl) Received: from smtp-vbr16.xs4all.nl (smtp-vbr16.xs4all.nl [194.109.24.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C86A43D49 for ; Fri, 10 Nov 2006 08:09:03 +0000 (GMT) (envelope-from nicky@valuecare.nl) Received: from [10.0.0.12] (a80-126-182-198.adsl.xs4all.nl [80.126.182.198]) (authenticated bits=0) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id kAA891r3073256 for ; Fri, 10 Nov 2006 09:09:02 +0100 (CET) (envelope-from nicky@valuecare.nl) Message-ID: <455433A4.1010403@valuecare.nl> Date: Fri, 10 Nov 2006 09:09:08 +0100 From: nicky User-Agent: Thunderbird 1.5.0.7 (X11/20061018) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4552E9F7.2000005@valuecare.nl> In-Reply-To: <4552E9F7.2000005@valuecare.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by XS4ALL Virus Scanner Subject: Possible bug in /usr/bin/script? (was A Sleeping FreeBSD Box (again).) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2006 08:09:04 -0000 nicky wrote: > Hello, > > This morning i had another 'sleeping' 6-stable box. I don't really > understand why it sleeps. I've checked acpi, but i doubt that is it. > Since at the time when it goes to sleep, it does some heavy > processing. I don't think it would choose to go to sleep then. The > most funny thing is, when you go to the console. You press Enter, just > Enter, you don't login, just punch the Enter button and the box > continues where it stopped. I typed in 'top' as soon as i could, which > showed the table below. > > The script commands capture the output of some shells scripts. > > last pid: 59391; load averages: 13.19, 4.43, > 2.70 up 14+17:21:56 08:43:04 > 93 processes: 15 running, 78 sleeping > CPU states: 5.7% user, 0.0% nice, 44.3% system, 0.0% interrupt, > 50.0% idle > Mem: 433M Active, 1577M Inact, 194M Wired, 158M Cache, 112M Buf, 644M > Free > Swap: 8192M Total, 320K Used, 8192M Free > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 58989 root 1 127 0 1340K 764K RUN 0 504:42 38561.75% > script > 58986 root 1 127 0 1340K 764K RUN 0 504:41 38547.86% > script > 58988 root 1 131 0 1340K 764K RUN 0 1:07 438.67% script > 58990 root 1 131 0 1340K 764K RUN 2 0:43 337.69% script > 58987 root 1 126 0 1340K 764K RUN 2 0:50 249.75% script > > > Is it safe for me to assume that something is hogging my cpu, not > allowing any other processes to get some cpu time? As a result the box > does not respond to anything, like pinging? > > Or does top has a weird way of showing the cpu times when it has been > sleeping? > > While i still find it rather weird, that pressing Enter seems to solve > it. > > I hope someone can send some advice or hints my way. > > Regards, > Nick > > > > > While trying to find out what is eating my CPU and probably making my box sleep. I've found something weird with /usr/bin/script. Assume the following small sh script called sleep.sh. #!/bin/sh while [ 1 ]; do sleep 3 echo "slept" done I'm executing the following: script outputfile ./sleep.sh Executed from a terminal window, all is as i would have expected. No CPU hogging and doing like it should. However if i execute it from cron, my CPU is used to the full 100%. Is this a bug and should i report it? Regards, Nick