From: <bl...@us...> - 2003-10-10 01:33:08
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv1345/scripts/scripts Added Files: portmap ypbind Log Message: Added NIS (YP), RPC Portmapper, and tcp_wrappers. --- NEW FILE: portmap --- #!/bin/bash # $Source: /cvsroot/devil-linux/build/scripts/scripts/portmap,v $ # $Revision: 1.1 $ # $Date: 2003/10/10 01:32:56 $ # # http://www.devil-linux.org # ### BEGIN INIT INFO # Provides: portmap # Required-Start: $network $syslog # Required-Stop: $network $syslog # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: RPC portmapper ### END INIT INFO # settings source /etc/sysconfig/config # parameters NAME="RPC Portmapper" CONFIGNAME=PORTMAP DAEMON=/sbin/portmap PARAMETER= PACKAGE_NAME=PORTMAP # source function library source /etc/init.d/functions eval START=\$START_$CONFIGNAME # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START=yes test "$START" = "yes" || exit 0 if [ ! -e $DAEMON ]; then echo echo "$DAEMON not found. Did you install the package?" exit 1 fi case "$1" in start) echo -n "Starting $NAME: " echo -n "($c) " loadproc $DAEMON -o $c RETVAL=$? # [ $RETVAL = 0 ] && touch $SUBSYS done ;; stop) echo -n "Shutting down $NAME: " for c in `ls /etc/cipe/options.cipcb* 2> /dev/null`; do echo -n "($c) " done killproc $DAEMON ;; restart | reload) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 ;; esac --- NEW FILE: ypbind --- #! /bin/sh # Copyright (c) 2001 Thorsten Kukuk <ku...@su...> # # init.d/ypbind # # and symbolic its link # # /usr/sbin/rcypbind # # System startup script for the ypbind daemon # ### BEGIN INIT INFO # Provides: ypbind # Required-Start: $remote_fs portmap ypserv # Required-Stop: portmap # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: Start ypbind (necessary for a NIS client) ### END INIT INFO # settings source /etc/sysconfig/config # parameters NAME="YPBIND" CONFIGNAME=NIS PARAMETER= # source function library source /etc/init.d/functions eval START=\$START_$CONFIGNAME # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START=yes test "$START" = "yes" || exit 0 YPBIND_BIN=/usr/sbin/ypbind test -x $YPBIND_BIN || exit 5 # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status #. /etc/rc.status # First reset status of this service #rc_reset # Return values acc. to LSB for all commands but status: # 0 - success # 1 - misc error # 2 - invalid or excess args # 3 - unimplemented feature (e.g. reload) # 4 - insufficient privilege # 5 - program not installed # 6 - program not configured # # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signalling is not supported) are # considered a success. case "$1" in start) echo -n "Starting ypbind" ## If the domainname is not set, skip starting of ypbind ## and return with "program not configured" /bin/ypdomainname &> /dev/null if [ $? -ne 0 -o -z "`/bin/ypdomainname`" ]; then # Tell the user this has skipped # rc_status -s # service is not configured print_status failure exit 6; fi ## If we don't have a /etc/yp.conf file, skip starting of ## ypbind and return with "program not configured" ## if you add the -broadcast Option later, comment this out. if [ ! -f /etc/yp.conf ] ; then # Tell the user this has skipped # rc_status -s # service is not configured print_status failure exit 6; fi ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. # startproc should return 0, even if service is # already running to match LSB spec. loadproc $YPBIND_BIN if [ $? -eq 0 ]; then notfound=1 for i in 1 2 3 4 5 6 7 8 9 10; do ypwhich &>/dev/null && { notfound=0 ; break; }; echo -n " ." sleep 1; done if [ $notfound -eq 1 ]; then echo -n " No NIS server found"; fi else # rc_failed print_status failure fi # Remember status and be verbose # rc_status -v print_status success ;; stop) echo -n "Shutting down ypbind" ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc TERM $YPBIND_BIN rm -f /var/yp/binding/* /var/run/ypbind.pid # Remember status and be verbose # rc_status -v # print_status success ;; try-restart) ## Stop the service and if this succeeds (i.e. the ## service was running before), start it again. $0 stop && sleep 1 && $0 start # Remember status and be quiet # rc_status print_status success ;; restart) ## Stop the service and regardless of whether it was ## running or not, start it again. $0 stop sleep 1 $0 start # Remember status and be quiet # rc_status print_status success ;; force-reload) ## Signal the daemon to reload its config. Most daemons ## do this on signal 1 (SIGHUP). ## If it does not support it, restart. echo -n "Reload service ypbind" ## if it supports it: killproc -HUP $YPBIND_BIN # rc_status -v print_status success ;; reload) ## Like force-reload, but if daemon does not support ## signalling, do nothing (!) # If it supports signalling: echo -n "Reload service ypbind" killproc -HUP $YPBIND_BIN # rc_status -v print_status success ;; status) echo -n "Checking for ypbind: " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. # Status has a slightly different for the status command: # 0 - service running # 1 - service dead, but /var/run/ pid file exists # 2 - service dead, but /var/lock/ lock file exists # 3 - service not running # If checkproc would return LSB compliant ret values, # things could be a little bit easier here. This will # probably soon be the case ... checkproc $YPBIND_BIN; rc=$? if test $rc = 0; then echo "OK" else echo "No process" if test -e /var/run/ypbind.pid; then exit 1 else exit 3 fi fi #rc_status print_status success ;; probe) ## Optional: Probe for the necessity of a reload, ## give out the argument which is required for a reload. test /etc/yp.conf -nt /var/run/ypbind.pid && echo reload ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" exit 1 ;; esac #rc_exit |