From owner-freebsd-rc@FreeBSD.ORG Tue May 24 12:04:42 2005 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6012916A41C; Tue, 24 May 2005 12:04:42 +0000 (GMT) (envelope-from swieten@itsef.com) Received: from postduif.itsef.com (ooievaar.itsef.com [62.58.92.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id B6D4143D1D; Tue, 24 May 2005 12:04:41 +0000 (GMT) (envelope-from swieten@itsef.com) Received: by postduif.itsef.com (Postfix, from userid 65534) id A6FCD3EA40; Tue, 24 May 2005 14:04:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by postduif.itsef.com (Postfix) with ESMTP id 86F113EA40; Tue, 24 May 2005 14:04:38 +0200 (CEST) Received: from [192.168.101.215] (pcs37345.itsef.com [192.168.101.215]) by postduif.itsef.com (Postfix) with ESMTP id 8E1AE38C7C; Tue, 24 May 2005 14:04:36 +0200 (CEST) Message-ID: <42931854.1010804@itsef.com> Date: Tue, 24 May 2005 14:04:36 +0200 From: Peter van Swieten User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-rc@freebsd.org, freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ITSEF-Virus-Scanned: by AMaViS snapshot-20020531 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on postduif.itsef.com X-Spam-Level: X-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.64 Cc: Subject: Strange behaviour of my script within /etc/rc.d X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2005 12:04:42 -0000 Hi, While trying to get my script within the /etc/rc.d tree operational I ran into some strange behaviour. I intended to start a vncserver as part of the boot process. I build the script based on several existing scripts (a.o. the apache script). The script works as expected when run from the command line in a operational FreeBSD system. During boot however it does not. Probem description: To be more specific it looks like the construction with the default value of a variable defined in the script and possibly being overridden in rc.conf DOES NOT WORK WHILE BOOTING. Note that since this is my first rc.d script, I might as well be doing something wrong, nevertheless the operation of the script works different in the two modes. Remark: I realize that there is a separate mailing list for rc.d things. The website for it however does not show any messages (but then maybe there are none). For this reason I post this message to both the general questions and the rc mailing list. Some details: ----------------------------------------------------------------------------------------------------------------- I recently installed this system from the 5.3 ISO. As far as I know nothing was changed to the rc.d part. uname -a output: FreeBSD peter-test-vm1.itsef.com 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 ----------------------------------------------------------------------------------------------------------------- rc.conf: ... # To start vncserver on startup: vncserver_enable="YES" vncserver_user="swieten" vncserver_display=":0" ... ----------------------------------------------------------------------------------------------------------------- my script: #!/bin/sh # PROVIDE: vncserver # This scripts starts vncserver running as user [vncserver_user] at [vncserver_display] # Author: PvSwieten # Define these vncserver_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # # DO NOT CHANGE THESE DEFAULT VALUES HERE # vncserver_enable="NO" vncserver_user="root" vncserver_display=":0" . /etc/rc.subr name="vncserver" rcvar=`set_rcvar` start_cmd="vncserver_start" stop_cmd="vncserver_stop" vncserver_start() { su -l ${vncserver_user} -c "/usr/local/bin/vncserver -geometry 1152x864 $vncserver_display" } vncserver_stop() { su -l ${vncserver_user} -c "/usr/local/bin/vncserver -kill ${vncserver_display}" } load_rc_config $name run_rc_command "$1" ----------------------------------------------------------------------------------------------------------------- -- -------------------------------------------------------- Peter van Swieten Tel +31 15 2692533 TNO-ITSEF BV Fax +31 15 2692555 Delftechpark 1 http://www.itsef.com 2628 XJ Delft swieten@itsef.com The Netherlands