From owner-freebsd-questions Sun Dec 17 20:41:18 2000 From owner-freebsd-questions@FreeBSD.ORG Sun Dec 17 20:41:14 2000 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from cae88-102-101.sc.rr.com (cae88-102-101.sc.rr.com [24.88.102.101]) by hub.freebsd.org (Postfix) with ESMTP id 9499E37B400 for ; Sun, 17 Dec 2000 20:41:13 -0800 (PST) Received: (from dmaddox@localhost) by cae88-102-101.sc.rr.com (8.11.1/8.11.1) id eBI4Wdi16416; Sun, 17 Dec 2000 23:32:39 -0500 (EST) (envelope-from dmaddox) Date: Sun, 17 Dec 2000 23:32:39 -0500 From: "Donald J . Maddox" To: Drew Tomlinson Cc: Moses Backman III , FreeBSD Questions Subject: Re: How to Get Program to Start Automatically Upon Boot Message-ID: <20001217233238.B16180@cae88-102-101.sc.rr.com> Reply-To: dmaddox@sc.rr.com Mail-Followup-To: Drew Tomlinson , Moses Backman III , FreeBSD Questions References: <20001217203634.A15545@cae88-102-101.sc.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from drewt@writeme.com on Sun, Dec 17, 2000 at 08:00:16PM -0800 Return-Receipt-To: dmaddox@sc.rr.com Sender: dmaddox@cae88-102-101.sc.rr.com Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In that case, you should create a startup script for it in /usr/local/etc/rc.d. The filename must end with '.sh' and it MUST be executable. It will be called at boot time with an argument of 'start' and at shutdown with an argument of 'stop', so your script can handle those two different cases (in case your program needs to clean up at shutdown or something). Here's an example that I use to start fetchmail at boot: #!/bin/sh if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then echo "$0: Cannot determine the PREFIX" >&2 exit 1 fi case "$1" in start) [ -x ${PREFIX}/bin/fetchmail ] && ( env FETCHMAILHOME=\/etc ${PREFIX}/bin/fetchmail & ) && echo -n ' fetchmail' ;; stop) ${PREFIX}/bin/fetchmail --quit && echo -n ' fetchmail' ;; *) echo "Usage: `basename $0` {start|stop}" >&2 ;; esac exit 0 On Sun, Dec 17, 2000 at 08:00:16PM -0800, Drew Tomlinson wrote: > I'm just trying to start the client for a dynamic IP service I subscribe > to. It's dynip.com and the client is called dynipclient. After > starting up, I just need to type it at the command line. From my DOS > days, I know I could put a command like that in autoexec.bat. I gather > that in FreeBSD, there are scripts instead of batch files. So I am > trying to do the equivalent. > > I see there are some old and new ways of doing this. My first version > of FreeBSD was the 4.0 release so I would prefer to learn the new. I'm > currently running 4.1.1 and plan to upgrade to 4.2 in the near future. > > Thanks for your help! > > Drew > > P.S. Are there any links you would recommend for a beginner to learn > about scripts? > > -----Original Message----- > From: Donald J . Maddox [mailto:dmaddox@sc.rr.com] > Sent: Sunday, December 17, 2000 5:37 PM > To: Moses Backman III > Cc: Drew Tomlinson; FreeBSD Questions > Subject: Re: How to Get Program to Start Automatically Upon Boot > > > On Sun, Dec 17, 2000 at 08:20:40PM +0000, Moses Backman III wrote: > > > > On 2000.12.18 01:17:02 +0000 Drew Tomlinson wrote: > > > I have added a program to my system and would like it to start > > > automatically upon boot. I'm sure it's as simple as adding the > program > > > name to some startup script but I don't know where that would be. > So > > > what file do I need to modify? > > > > > > Thanks for your help! > > > > > > Drew > > > > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > with "unsubscribe freebsd-questions" in the body of the message > > > > > add to /etc/rc before the exit 0 line > > You should NOT edit /etc/rc. > > You can create an /etc/rc.local to run your program at boot, but there > may be a better solution still, depending on exactly what you are trying > to start. What are you trying to do, exactly? What program do you > want to start? > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message