starting daemons at server start

Micke P mickep3 at yahoo.com
Sun Jan 4 13:16:38 PST 2004


Hi Subhro :-),

Good information. After checking, I didn't have the
"local_startup" line in my /etc/rc.conf file. 

This didn't work on restarting just now, but I added
the line pointing to the rc.d apache dir where I had
added the file apache.sh earlier (below). Still had to
start apache by hand. I don't know if the script is
correct, because there was no example script and I
changed the script from another daemon. If so, I'm
still missing something.

Micke

>
#!/bin/sh
echo -n ' Apache'

case "$1" in
start)
       /usr/local/apache/bin/apachectl start
       ;;
stop)
       /usr/local/apache/bin/apachectl stop
       ;;
*)
       echo "Usage: 'basename $0' (start|stop)" >&2
       exit 64
       ;;
esac

exit 0
<


--- Subhro <subhro at fusemail.com> wrote:
> Hello Micke,
> Well there are quite a few ways in which you can
> start a daemon
> "automatically". I would brief them for you. The
> most common daemons like
> sshd, apmd check the /etc/rc.conf for start
> commands. So if you want to
> start sshd at startup just put a line
> sshd_enable="YES" in /etc/rc.conf and
> you will be back in business. For a list of all the
> daemons which can be
> started from rc.conf, refer to
> /etc/defaults/rc.conf. But DON'T modify that
> file. Instead copy that file to /etc and change it
> there if you don't have
> rc.conf in /etc initially. /etc/rc.conf overrides
> anything in
> /etc/defaults/rc.conf.
> 
> The next common procedure of starting daemons in
> from within the inetd
> superserver.Inetd works as: it does not start the
> daemon initially. Instead
> it starts listening on the port which the daemon is
> supposed to listen on.
> For example if you are planning to start telnetd
> from inetd, then after the
> system startup, inetd will listen on port 23 and
> start up telnetd only when
> it senses someone knocking on port 23. In this way
> you can save on system
> resources by not starting the services unless you
> need them. For the inetd
> to waork you need to include a like
> inetd_enable="YES" in /etc/rc.conf.
> 
> However inetd has its cons as well. If you have a
> very busy webserver (for
> instance) and plan to start httpd (the webserver
> daemon) from inetd, then
> the overhead will be very high as inetd spawns a
> separate process for each
> incoming request. So sys-admins consider running
> daemons as staanalone. When
> you install some daemon like apache (for example)
> then you will find a
> startup file in /usr/local/etc/rc.d/. Most likely it
> would be names as
> daemon_name.conf.sample. Change the name to
> daemon_name.conf and change the
> permissions to 755 while you are logged in as root.
> At every boot the script
> will be called with a start argument which will
> start the service and at
> every shutdown it will be called with a stop
> argument. I would not give you
> a prize if you manually call the script with start,
> stop and restart
> arguments :-).
> 
> The last but not the least. You can also start
> services from within crontab.
> But that's too cumbersome. Hence I don't like it.
> Refer to this page if you
> want to know how.
> 
>
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-start
> ing-services.html
> 
> I hope I have answered some of your queries. Do let
> us know if you need some
> more help.
> 
>  Remember FreeBSD unlike windows can dare to say
> "Power to Serve" :-)
> 
> Regards
> Subhro
> 
> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org
> [mailto:owner-freebsd-questions at freebsd.org] On
> Behalf Of Micke P
> Sent: Monday, January 05, 2004 12:05 AM
> To: freebsd-questions at FreeBSD.ORG
> Subject: starting daemons at server start
> 
> 
> Hi,
> 
> There are a couple of things that I'm struggling
> with
> unsuccessfully. :-(  One of them is figuring out how
> to get daemons to start up when the server starts,
> or
> restarts, without having to start them manually. It
> may be clearly defined in the handbook, but I am
> inept
> enough to not see it. This is a configuration in the
> inetd?
> 
> Thanks,
> Micke
> 
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
>
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"
> 
> 
> 
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the freebsd-questions mailing list