From owner-freebsd-questions@FreeBSD.ORG Tue Apr 29 06:09:06 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D86E0106566C for ; Tue, 29 Apr 2008 06:09:06 +0000 (UTC) (envelope-from gary@pattersonsoftware.com) Received: from nschwmtas02p.mx.bigpond.com (nschwmtas02p.mx.bigpond.com [61.9.189.140]) by mx1.freebsd.org (Postfix) with ESMTP id 604F88FC1A for ; Tue, 29 Apr 2008 06:09:06 +0000 (UTC) (envelope-from gary@pattersonsoftware.com) Received: from nschwotgx01p.mx.bigpond.com ([121.223.241.235]) by nschwmtas02p.mx.bigpond.com with ESMTP id <20080429060905.KPAP23069.nschwmtas02p.mx.bigpond.com@nschwotgx01p.mx.bigpond.com> for ; Tue, 29 Apr 2008 06:09:05 +0000 Received: from mail.pattersonsoftware.com ([121.223.241.235]) by nschwotgx01p.mx.bigpond.com with ESMTP id <20080429060903.GUAV1861.nschwotgx01p.mx.bigpond.com@mail.pattersonsoftware.com> for ; Tue, 29 Apr 2008 06:09:03 +0000 Received: from localhost (mail [192.168.111.46]) by mail.pattersonsoftware.com (Postfix) with ESMTP id 8F1015363D8 for ; Tue, 29 Apr 2008 16:09:03 +1000 (EST) X-Virus-Scanned: amavisd-new at pattersonsoftware.com Received: from mail.pattersonsoftware.com ([192.168.111.46]) by localhost (mail.pattersonsoftware.com [192.168.111.46]) (amavisd-new, port 10024) with ESMTP id Jz35zhPFuLyF for ; Tue, 29 Apr 2008 16:08:54 +1000 (EST) Received: from elegia (60-242-254-180.static.tpgi.com.au [60.242.254.180]) by mail.pattersonsoftware.com (Postfix) with ESMTP id 3760553609B for ; Tue, 29 Apr 2008 16:08:53 +1000 (EST) Date: Tue, 29 Apr 2008 16:08:51 +1000 From: Gary Newcombe To: freebsd-questions@freebsd.org Message-Id: <20080429160851.8f21394e.gary@pattersonsoftware.com> Organization: Patterson Software X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RPD-ScanID: Class unknown; VirusThreatLevel unknown, RefID str=0001.0A150203.4816BB80.00C0,ss=1,fgs=0 Subject: Spawning Xdialogs from devd... 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: Tue, 29 Apr 2008 06:09:06 -0000 G'day. This is an X61 laptop, and I'm trying to use the Fn keys to call scripts to do various jobs, while informing users or getting input using Xdialog popups. Here's an example case. Rebooting the pc if pressing Fn+F4. [/etc/devd.conf] ... notify 10 { match "system" "ACPI"; match "subsystem" "IBM"; action "/root/bin/acpi_oem_exec.sh $notify ibm"; }; [/root/bin/acpi_oem_exec.sh] ... #!/bin/sh NOTIFY=`echo $1` case ${NOTIFY} in 0x04) /home/rep/bin/script.sh & MESSAGE="do script" ;; *) MESSAGE="nothing found" ;; esac ... [/etc/sysctl.conf] ... dev.acpi_ibm.0.events=1 [/home/rep/bin/reboot.sh] ... #!/bin/sh if [ ! -f /tmp/reboot ] ; then touch /tmp/reboot title="Reboot computer" msg="Laptop is rebooting immediately..." Xdialog --title "$title" --beep --ok-label "OK" --infobox "$msg" 5 40 2000 > /dev/null 2>&1 wavplay /home/rep/sounds/shutdown.wav > /dev/null 2>&1 shutdown -r now fi exit 0 >From a fresh boot and startx, pressing Fn+F4 from the window manager (Window Maker) calls the script and executes, but no Xdialog or sound. If I startx and run devd in the foreground with: sh /etc/rc.d/devd stop && devd -dD\ all is fine, Xdialogs displayed and sound too. Likewise, if I restart devd from an xterm (sh /etc/rc.d/devd restart), all is fine: However, if I restart devd from an ssh term or another console, only sound, no Xdialogs. I'm curious to know what is actually going on here. I wouldn't have thought the context from which devd is restarted would make any difference, but clearly it does. Any clues? Also, does anyone have any ideas how I can call Xdialog to get the windows displayed? Many thanks, Gary ---