Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2000 23:32:39 -0500
From:      "Donald J . Maddox" <dmaddox@sc.rr.com>
To:        Drew Tomlinson <drewt@writeme.com>
Cc:        Moses Backman III <penguinjedi@home.com>, FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: How to Get Program to Start Automatically Upon Boot
Message-ID:  <20001217233238.B16180@cae88-102-101.sc.rr.com>
In-Reply-To: <BA5D0CE1CBB2D411B6AA00A0CC3F02390AF775@ldcmsx01.lc.ca.gov>; from drewt@writeme.com on Sun, Dec 17, 2000 at 08:00:16PM -0800
References:  <20001217203634.A15545@cae88-102-101.sc.rr.com> <BA5D0CE1CBB2D411B6AA00A0CC3F02390AF775@ldcmsx01.lc.ca.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001217233238.B16180>