Subject: Re: run ddb(4) in "batch mode"
To: None <>
From: Jukka Salmi <>
List: current-users
Date: 03/28/2007 15:52:52
One sentence seems to have disappeared somehow :-P

Jukka Salmi --> current-users (2007-03-28 15:45:02 +0200):
> Hi,
> on a semi-production system I wanted to run some ddb commands in case
> of kernel panics while still achieving best possible uptime, i.e.
> without having to intervene manually to get the system up and running
> again. I set
> 	ddb.onpanic=1
> 	ddb.tee_msgbuf=1
> 	ddb.commandonenter='trace; [...]; reboot 0x4'
> and configured the system notice me in case of an unclean shutdown.
> This didn't really work as expected because the ddb.commandonenter
> commands caused ddb to print more than ddb.lines (24) lines of output;
> thus ddb waited for user input to print the next page of output, and
> didn't execute the `reboot' command automatically...
> To fix this problem I added a new variable `batchmode', accessible via
> sysctl(3) as the other built-in ddb variables.

If set, ddb doesn't prompt for user input after 24 (or whatever
ddb.lines is set to) lines were output.

Regards, Jukka

> The resulting patch
> against netbsd-4 is attached.
> Comments are welcome. Please tell in case this is of use for anybody
> else, and I'll send a PR.

bashian roulette:
$ ((RANDOM%6)) || rm -rf ~