Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Dec 2003 00:47:08 +0100
From:      "Daan Vreeken [PA4DAN]" <Danovitsch@Vitsch.net>
To:        "gffds fsdff" <eurijk666@hotmail.com>
Cc:        FreeBSD-questions@FreeBSD.org
Subject:   Re: The Booting Process
Message-ID:  <200312250047.08843.Danovitsch@Vitsch.net>
In-Reply-To: <BAY7-F30gCT49PXcdKE000152fc@hotmail.com>
References:  <BAY7-F30gCT49PXcdKE000152fc@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 25 December 2003 00:25, gffds fsdff wrote:
> Is there a way, when booting, to have an application launch?
> Ex:
> exec /usr/servers/bots/zDSBot3/zDSBot3 &
Have a look at /usr/local/etc/rc.d
All scripts that are executable and end in ".sh" in that directory get=20
executed at boot-time. You could create your own scripts in that director=
y=20
that starts your application.

On boot the scripts are executed with the first agrument being "start". O=
n=20
shutdown the scripts are executed with "stop" as first argument. By check=
ing=20
the argument in your script you can determine if you should start the=20
application or not. (Don't start it at shutdown :)

A simple rc.d-script could look something like this :
--- cut here ---
#!/bin/sh
case "$1" in
start)
=09/some/dir/some-app && echo -n ' some-app'
        ;;
stop)
        ;;
*)
        echo "Usage: `basename $0` {start|stop}" >&2
        ;;
esac
exit 0
--- cut here ---

The "echo -n" line is the output you see when you boot your system after =
:
"Local package initialization :"
This only works on applications that daemonize (dissapear into the backgr=
ound=20
when you start them). If your program doesn't daemonize, you should start=
 it=20
with an "&" sign behind it...

grtz,
Daan



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