SUMMARY: Applications startup

From: Hubert Ulliac - Universite de Haute Bretagne <Hubert.Ulliac_at_Uhb.Fr>
Date: Fri Jun 16 11:37:07 1995

Bonjour,

Firts, thanks to all the people who took their time to reply !

My original post :

>What's the best solution for starting applications on Dec Unix ?

Three solutions were suggested :

1)
>put a script in /sbin/init.d, with a link to it in
>/sbin/rc3.d (assuming the application is only to start in
>multi-user mode).The links in /sbin/rc3.d (or the scripts they
>point to) are executed in ascending numeric order. So for instance
>you might make a script /sbin/init.d/test which starts your
>application, with a link at /sbin/rc3.d/S97test
>
>"Some applications will not start this way (they exit with the
>startup script). If this happens, the only solution I have found
>which works consistently is to create another (trivial) script
>to start the application, which the first script submits as an
>"at" request. For instance, your /sbin/init.d/test script
>might contain
> at now + 1 minute /sbin/init.d/start-test"

> The files that start with 'S*' are invoked at system boot.
> Files with 'K*' are invoked during system shutdown.

>-------------------- http://www.fys.ruu.nl/~mos -------------------
>
>#!/sbin/sh
>#
># Script to start httpd daemon
>
>PATH=/sbin:/usr/sbin:/usr/bin
>export PATH
>
>case "$1" in
>'start')
> set `who -r`
> if [ "$9" = "S" ]; then
> if [ -f /usr/adm/httpd/httpd ]; then
> /usr/adm/httpd/httpd -d /usr/adm/httpd
> echo "httpd daemon started"
> else
> echo "Unable to start httpd"
> exit 1
> fi
> else
> echo "Unable to start httpd, Run level must be S"
> exit 1
> fi
> ;;
>'restart')
> echo "No restart option available for httpd"
> ;;
>*)
> echo "usage: $0 {start|stop|restart}"
> ;;
>esac

>Create a file called /sbin/init.d/local and put your local command
>there. It should look like:
>
>#!/sbin/sh
>
>set `who -r`
>if [ "$9" != "S" ]
>then
> exit
>fi
>
>#
># start up httpd server
>#
>/usr/local/etc/httpd/httpd -d /usr/local/etc/httpd
>#
># start up the phmail server
>#
>nohup /usr/local/nameserv/phmail >/dev/null 2>&1 &

>I use one link:
>
>/sbin/rc3.d/S94systartup -> /usr/local/systartup/<your-script>
>
>and the script has things like
>
> if [ -f /usr/local/bin/httpd/httpd ]; then
> /usr/local/bin/httpd/httpd -d /usr/local/bin/httpd
> fi


>I have a script called httpd in the /sbin/init.d directory :
>
>Script follows -----------------------------------------------
>#!/bin/sh
># Scrip to control web server, David Bannon, 26-10-94
>#>PATH=/sbin:/usr/sbin:/usr/bin>export PATH
>case "$1" in>'start')
> if [ -f /disk2/httpd/httpd ]
> then
> /disk2/httpd/httpd -d /disk2/httpd &
> echo "Starting WEB Server"
> fi
> ;;
>'stop')
> kill `cat /disk2/httpd/logs/httpd.pid`
> ;;
>'who')
> grep -v 'bc.*.latrobe.edu.au' /disk2/httpd/logs/access_log | more
> ;;
>'error')
> cat /disk2/httpd/logs/error_log
> ;;
>*)
> echo "usage: httpd {start|stop}"
> ;;
>esac
>--------------------------------------------- Script ends.


cstrmr_at_staffs.ac.uk
kleemann_at_informatik.uni-wuerzburg.de
rjackson_at_gmu.edu
stellr_at_smyrna.cc.vt.edu
tom_at_silverlock.dgim.doc.ca
H.J.Mos_at_fys.ruu.nl
magali_at_lune.lirmm.fr
SLOANE_at_KUHUB.CC.UKANS.EDU
gomide_at_fapq.fapesp.br
rockwel_at_rch.dec.com
gunther_at_vivid.com
carole_at_callutheran.edu
D.Bannon_at_latrobe.edu.au
zim_at_cygne.lbs.cnrs-gif.fr

2)
>The respawn parameter causes initd to restart an application as soon as it
>exits. If "test" is a script that fires up httpd and then exits, initd will
>instantly run it again--even though httpd is still running.
>
>There are two solutions--one is to only use respawn on an actual
>application. Note that this doesn't work on an application that daemonizes
>itself.
>
>http:3:respawn:/usr/local/http/httpd
>
>If the application daemonizes itself (ie, you get returned to the command
>line without putting '&' at the end of the program name), then you have to
>use the "once" parameter. You'll also have to figure out another way to get
>the app restarted if it dies.
>
>http:3:once:/usr/local/http/httpd
>
>If you want to use a script, then either use the "once" parameter or make
>sure the script never exits (and make it responsible for restarting the
>application):
>
>test:3:respawn:/usr/local/test
>
>test:
>#!/bin/sh
>#
># run httpd and restart it if it exits
>
>while 1
>do
> cd /usr/local/http
> httpd
> # if we get here we've exited httpd
> # pause for a few seconds to let everything recover
> sleep 15
>done

>Change tht to:
>
>test:3:once:/usr/local/test
>These daemons, typically fork (perhaps a couple of times), and then let the
>parent exit. The respawn directive is not appropriate in cases like this.

BEEBE_at_BIOMED.MED.YALE.EDU
steve_at_aztech.com
KatzL_at_msgate.gseps.com
nicolis_at_celfi.phys.univ-tours.fr
KatzL_at_msgate.gseps.com



3)
>For an application such as "httpd", that should be executed through the use of
>'inetd'. To properly setup 'httpd' is to put an entry in both your
>"/etc/services"
>and "/etc/inetd.conf" files.
>
>"/etc/services"
>
>http 80/tcp # httpd server (World Wide Web tool)
>
>"/etc/inetd.conf"
>
>http stream tcp nowait httpu /usr/local/bin/httpd httpd
>
>
>For an application such as "AF", that should be started in "/sbin/rc2" or
>"/sbin/rc3"
>along with the other applications.


winger_at_sewp.nasa.gov


Et encore merci ` tous


-------------------------------------------------------------------------------
Hubert ULLLIAC ! Telephone: (33) 99 33 52 79
Universite de Haute Bretagne ! Telecopie: (33) 99 33 52 73
Centre de Ressources Informatiques !
6 Avenue Gaston Berger !
F-35043 RENNES Cedex ! E-Mail : Hubert.Ulliac_at_Uhb.Fr
-------------------------------------------------------------------------------
Received on Fri Jun 16 1995 - 11:37:07 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT