Date: Sun, 26 Feb 2006 22:04:37 -0500 (EST) From: Jerry McAllister <jerrymc@clunix.cl.msu.edu> To: listor@melin.org (Joacim Melin) Cc: freebsd-questions@freebsd.org Subject: Re: Startup script Message-ID: <200602270304.k1R34bf3019441@clunix.cl.msu.edu> In-Reply-To: <C1F18591-C716-4942-BD86-39C7BA56D816@melin.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> > Hi all, > > newbie question: which script do I put stuff that needs to be booted > during system startup, like apache httpd, spamd, named, etc? First of all, you should put a separate script for each utility to start in the /usr/local/etc/rc.d/ directory. Many of these utilities do that for you automatically when you install them through the ports system. The script should be written to accept at least start|stop as arguments. When the system boots, it attempts to run every script in that directory, I believe in standard sort order and gives each the 'start' argument. Then when the shutdown is run, it runs each with the 'stop' argument. To qualify for execution, the sctipt name must end in '.sh' and it must have execute persission. Some of them must be activated by putting a line in the /etc/rc.conf.local file (or just /etc/rc.conf if you prefer but I don't like to clutter it up too much) to set an appropriate environment variable. Most of them are in the form of something like UTILITY_RUN=YES or similar. Check the script and the utility documentation to see what sort of environment variable must be set. The script checks for whatever environment variable it wants to when it runs to see what it should do. A very old fashioned and currently unsupported way was to put a command in the /etc/usr.local file, but that is no longer a good way to do it. ////jerry > > Joacim >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602270304.k1R34bf3019441>