Date: Wed, 06 Feb 2008 15:55:12 +0100 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-questions@freebsd.org Subject: Re: script to be executed on system startup. Message-ID: <fochm5$gre$1@ger.gmane.org> In-Reply-To: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com> References: <1563a4fd0802060609j59451879h3920be790d7667c0@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fochm5$gre$1>