Author: baggins                      Date: Mon Jul 25 23:16:20 2005 GMT
Module: nps                           Tag: HEAD
---- Log message:
- cleaned up and renamed init script, still more to do

---- Files affected:
nps/poci/script:
   poci.init (NONE -> 1.1)  (NEW), poci (1.1.1.1 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: nps/poci/script/poci.init
diff -u /dev/null nps/poci/script/poci.init:1.1
--- /dev/null   Tue Jul 26 01:16:20 2005
+++ nps/poci/script/poci.init   Tue Jul 26 01:16:15 2005
@@ -0,0 +1,131 @@
+#!/bin/sh
+#
+# poci         Start/Stop the poci daemon
+#
+# chkconfig:   2345 55 25
+# description: Poci daemon
+# processname: nws_poci
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/poci ] && . /etc/sysconfig/poci
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; 
then
+               msg_network_down poci
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+
+KERNEL_VERSION=$(uname -r | sed "s/\([0-9]*\.[0-9]*\)\..*/\1/")
+PLATFORM=$(uname -m)
+
+EXTRA_CMDS=""
+JNET_INSMOD=jnet_prs
+MC_INSMOD=nws_mc
+if [ "$KERNEL_VERSION" = "2.6" ] ; then
+       EXTRA_CMDS="route add -host 169.254.101.2 jnet0"
+       if [ "$PLATFORM" = "x86_64" ] ; then
+               MC_INSMOD=""
+       fi
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       if [ ! -f /var/lock/subsys/poci ]; then
+               msg_starting poci
+
+               # let's remove them to stop any kind of confusion...
+               rm -f /dev/jnet
+               rm -f /dev/nws_mc
+
+               modprobe $JNET_INSMOD >/dev/null
+               if [ $? -ne 0 ] ; then
+                       echo "failed"
+                       exit 1
+               fi
+
+               if [ "$MC_INSMOD"xx != "xx" ] ; then
+                       modprobe $MC_INSMOD >/dev/null
+                       if [ $? -ne 0 ] ; then
+                               echo "failed"
+                               exit 1
+                       fi
+                       maj_num=`cat /proc/nws_mc/major`
+                       mknod /dev/nws_mc c ${maj_num} 0
+               fi
+
+               maj_num=`cat /proc/jnet/major`
+               mknod /dev/jnet c ${maj_num} 0
+
+               # there is some concern about configuring jnet too fast
+               sleep 1
+               ifconfig jnet0 169.254.101.3
+               if [ $? -ne 0 ] ; then
+                       echo "failed"
+                       exit 1
+               fi
+
+               $EXTRA_CMDS
+               if [ $? -ne 0 ] ; then
+                       echo "failed"
+                       exit 1
+               fi
+
+               daemon nws_poci
+               RETVAL=$?
+
+               daemon nws_hb
+               daemon nws_mc
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/poci
+       else
+               msg_already_running poci
+       fi
+       ;;
+  stop)
+       if [ -f /var/lock/subsys/poci ]; then
+               msg_stopping poci
+
+               killproc nws_poci
+               RETVAL=$?
+               killproc nws_hb
+               killproc nws_mc
+
+               sleep 1
+               ifconfig jnet0 down
+
+               if lsmod | grep -q ^nws_mc ; then
+                       rmmod nws_mc
+               fi
+               rmmod jnet_prs
+
+               rm -f /dev/jnet
+               rm -f /dev/nws_mc
+
+               rm -f /var/lock/subsys/poci
+       else
+               msg_not_running poci
+       fi
+       ;;
+  restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart}"
+       exit 3
+esac
+
+exit $RETVAL
================================================================
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to