From owner-freebsd-questions@FreeBSD.ORG Wed Feb 6 14:54:11 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 0D13316A420 for ; Wed, 6 Feb 2008 14:54:11 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 6F17A13C47E for ; Wed, 6 Feb 2008 14:54:10 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JMlf1-0000Bz-7Y for freebsd-questions@freebsd.org; Wed, 06 Feb 2008 14:54:03 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Feb 2008 14:54:03 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Feb 2008 14:54:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Ivan Voras Date: Wed, 06 Feb 2008 15:55:12 +0100 Lines: 68 Message-ID: References: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig63DBAC55DFE4EB3F51C4E550" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.6 (X11/20071022) In-Reply-To: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> X-Enigmail-Version: 0.95.0 Sender: news Subject: Re: script to be executed on system startup. 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: Wed, 06 Feb 2008 14:54:11 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig63DBAC55DFE4EB3F51C4E550 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable navneet Upadhyay wrote: > Hi, > I have a script file, i want that script to be executed on system= > startup. >=20 > I am doing this on Linux in following two steps : - >=20 > 1. Copying the script to /etc/rc.d directory. > 2. /sbin/chkconfig --add "scriptname" >=20 >=20 > I want to achieve the same on FreeBSD >=20 > chckconfig file is not present, documentation says i have to add it to > rc.conf file. I've seen some complicated examples on this thread, and want to suggest a simple one: 1. create a regular shell script in /etc/rc.d, name it whatever you like (for example: "/etc/rc.d/myscript") 2. chmod a+x the script 3. you're done. This will work for the recent versions of FreeBSD (you didn't say for which version do you need it). A more semantically pure example (and the one that's preferred if your script starts an external application - a web server or something like that) is to put the script in /usr/local/etc/rc.d. In any case, the syntax and everything else is the same. An advanced feature is to regulate when the script will be executed (in Linux, this is accomplished by all those ugly symlinks like S86Something). Here it is done by adding special comments to the beginning of the file in the format # AFTER: FILESYSTEMS or # BEFORE: LOGIN See rcorder(8) man page for details. (most of the advices given here will also work on NetBSD). --------------enig63DBAC55DFE4EB3F51C4E550 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHqcpQldnAQVacBcgRAtNZAJ0YQtQE11/kZ2EqdKRiYY6TCwy7XACgzqCG Bc8QHiU/0h1FLrokUT2Ha38= =/AgQ -----END PGP SIGNATURE----- --------------enig63DBAC55DFE4EB3F51C4E550--