From owner-freebsd-questions@FreeBSD.ORG Mon Apr 2 19:47:46 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2EFAE16A40A for ; Mon, 2 Apr 2007 19:47:46 +0000 (UTC) (envelope-from nagylzs@freemail.hu) Received: from smtp.enternet.hu (smtp.enternet.hu [62.112.192.21]) by mx1.freebsd.org (Postfix) with ESMTP id E4DFD13C480 for ; Mon, 2 Apr 2007 19:47:45 +0000 (UTC) (envelope-from nagylzs@freemail.hu) Received: from [62.68.177.164] (helo=[172.16.0.43]) by smtp.enternet.hu with esmtpa (Exim 4) id 1HYSVE-000D08-6Q; Mon, 02 Apr 2007 21:47:44 +0200 Message-ID: <46115DE2.7060408@freemail.hu> Date: Mon, 02 Apr 2007 21:47:46 +0200 From: =?ISO-8859-1?Q?Nagy_L=E1szl=F3_Zsolt?= User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Charles Farinella , freebsd-questions@freebsd.org References: <46113D03.6000604@appropriatesolutions.com> <20070402120758.M34595@wonkity.com> <461154E9.8030208@appropriatesolutions.com> In-Reply-To: <461154E9.8030208@appropriatesolutions.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: automatically starting PostgreSQL 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: Mon, 02 Apr 2007 19:47:46 -0000 > > For reasons having to do with our particular operation, it is our > custom to build many packages from source code no matter the operating > system, so I don't want to install from the ports tree. Did you know that when you install from the ports tree, it will actually download the sources, make important patched for freebsd, and install from that source? In particular, you can give CFLAGS, makefile defines etc. In addition, when you install it from the ports tree, it gets recorded in the package database so you can install other applications that depend on postgresql. (For example, pgadmin3). Why do you want to install it from the sources? If you only want to optimize for your CPU and compile some contrib/extension modules, then you do not need to install from a source tarball yourself. Using the port will be enough. > The script I used is one which is part of the PostgreSQL package and > is specifically for FreeBSD. As I said the script works as expected. > '/etc/rc.d/postgresql start|stop|restart' all work. I also have a > duplicate script in /usr/local/etc/rc.d which also works as expected > when run manually. Neither of these start the server at boot time. First of all, since postgresql is not part of the base system, you should put its rc script under /usr/local/etc/rc.d instead of /etc/rc.d. The rc script won't be execute unless the following criterion are met: 1. The script is executeable (chmod +x ) 2. The script has a .sh suffix, OR it uses rcorder. (See: man rcorder). Using rcorder is the better because you can define when to start your service. (Obvious example: you need to start networking before starting postgresql...) 3. If the script supports rc variables, then probably you need to adjust some variables in /etc/rc.conf. However, it depends on the script itself. Most ports work with rc scripts. Custom programs installed from source may not need this. > I have an apache2 installation also built from source code, and also > with a script from an external source, also placed in /etc/rc.d and > referenced by the line 'apache2_enable="YES"', and this *does* start > at boot time. I guess because it is named "apache.sh" instead of "apache", am I right? > So I am a little confused as to what I need to do. If I add .sh to > /usr/local/etc/rc.d/postgresql, in my /etc/rc.conf do I change my > reference line to 'enable_postgresql.sh="YES"'? Of course not. The rc variables can be set in rc.conf. They will be checked by the postgresql.sh script. E.g. it is not the base system that checks these variables. Putting variables in rc.conf for programs like postgresql is good because usually you want to disable/enable services in rc.conf. Configuring postgresql is another story. However, it is the startup script of your program that needs to have support for rc variables. I hope this helps. Best, Laszlo