File: decnet.sh

package info (click to toggle)
dnprogs 2.37.2-0.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,380 kB
  • ctags: 3,838
  • sloc: ansic: 24,383; cpp: 10,540; makefile: 753; sh: 553; awk: 13
file content (107 lines) | stat: -rwxr-xr-x 2,359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
#
# decnet.sh
#
# Starts/Stops DECnet processes
#
# chkconfig: - 09 91
# description:  DECnet.
# processname: dnetd
# config: /etc/decnet.conf
#
#
# This script should go in
#  /etc/init.d for redhat 7.0 onwards
#  /etc/rc.d/init.d for redhat up to 6.2
#
# You can install it using the following command:
#
# chkconfig --level 345 decnet on
#
# -----------------------------------------------------------------------------
#
# Daemons to start. You may remove the ones you don't want
#
daemons="dnetd phoned"

# Prefix for where the progs are installed. "make install" puts them
# in /usr/local, the RPM has them in /usr
prefix=/usr/local

#
# Interfaces to set the MAC address of. By default only the default interface
# in /etc/decnet.conf will be set. If you want to set up more interfaces
# for DECnet than add them here.
#
extra_interfaces=""

#
# Set up some variables.
#
. /etc/rc.d/init.d/functions
startcmd="daemon"
stopcmd="killproc"
startendecho=""
stopendecho="done."

case $1 in
   start)
     if [ ! -f /etc/decnet.conf ]
     then
       echo $"DECnet not started as it is not configured."
       exit 1
     fi

     # If there is no DECnet in the kernel then try to load it.
     if [ ! -f /proc/net/decnet ]
     then
       modprobe decnet
       if [ ! -f /proc/net/decnet ]
       then
         echo $"DECnet not started as it is not in the kernel."
	 exit 1
       fi
     fi

     echo -n $"Starting DECnet: "

     NODE=`grep executor /etc/decnet.conf| awk '{print $2}'`
     echo "$NODE" > /proc/sys/net/decnet/node_address
     CCT=`grep executor /etc/decnet.conf | awk '{print $6}'`
     echo "$CCT" > /proc/sys/net/decnet/default_device
     $prefix/sbin/setether $NODE $CCT $extra_interfaces 

     for i in $daemons
     do
       $startcmd $prefix/sbin/$i
       echo -n $" `eval echo $startecho`"
     done
     echo $"$startendecho"
     ;;

   stop)
     echo -n $"Stopping DECnet... "
     for i in $daemons
     do
       $stopcmd $prefix/sbin/$i
     done
     echo $"$stopendecho"
     ;;

   restart|reload|force-reload)
     echo -n $"Restarting DECnet: "
     for i in $daemons
     do
       $stopcmd $prefix/sbin/$i
       $startcmd $prefix/sbin/$i
       echo -n $"$startecho"
     done
     echo $"$stopendecho"
     ;;

   *)
     echo $"Usage $0 {start|stop|restart|force-reload}"
     ;;
esac

exit 0