Debian Codegraph @

start

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # start -- start up configured conmux servers on this host.
4 #
5 # (C) Copyright IBM Corp. 2004, 2005, 2006
6 # Author: Andy Whitcroft <[email protected]>
7 #
8 # The Console Multiplexor is released under the GNU Public License V2
9 #
10 if [scip-shell system . . `[`. -f ~/.gmm.conf ]; then
11 . ~/.gmm.conf
12 fi
13 CONMUX=${CONMUX:-/usr/local/conmux}
14
15 cmd="start"
16 if [scip-shell system . . `[`. "$1" != "" ]; then
17 cmd="$1"
18 fi
19
20 PATH=$CONMUX/bin:$CONMUX/sbin:$CONMUX/lib/drivers:$CONMUX/lib/helpers:$PATH
21
22 function startscip-shell shell conmux 0.12.0-6 start().() {
23 typeset name="$1"
24 typeset pf="$CONMUX/log/$name.pid"
25
26 shift
27
28 # Determine whether it is already running ... if so leave it be.
29 if [scip-shell system . . `[`. -f "$pf" ]; then
30 if killscip-shell system . . kill. -0 `catscip-shell system . . cat. "$pf"` 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
31 return 1
32 fi
33 fi
34
35 echoscip-shell system . . echo. "starting $name ..."
36 "$@" >"$CONMUX/log/$name.log" 2>&1 &
37 echoscip-shell system . . echo. "$!" >"$pf"
38
39 return 0
40 }
41 function stopscip-shell shell conmux 0.12.0-6 stop().() {
42 typeset name="$1"
43 typeset pf="$CONMUX/log/$name.pid"
44
45 echoscip-shell system . . echo. "stopping $name ..."
46 # Kill it and clear up
47 killscip-shell system . . kill. -HUP `catscip-shell system . . cat. "$pf"` 2>/dev/nullscip-shell filesystem . . `/dev/null`.
48 rmscip-shell system . . rm. -f "$pf"
49 }
50
51 existing=""
52 for i in $CONMUX/log/*.pid
53 do
54 n=${i%.pid}
55 n=${n#$CONMUX/log/}
56
57 if [scip-shell system . . `[`. "$n" != "*" ]; then
58 existing="$existing $n"
59 fi
60 done
61
62 if [scip-shell system . . `[`. "$cmd" = "start" ]; then
63 autoboot=""
64 [scip-shell system . . `[`. -f $CONMUX/etc/registry ] || touchscip-shell system . . touch. $CONMUX/etc/registry
65 startscip-shell shell conmux 0.12.0-6 start(). registry $CONMUX/sbin/conmux-registry 63000 $CONMUX/etc/registry
66 if [scip-shell system . . `[`. "$?" -eq 0 ]; then
67 sleepscip-shell system . . sleep. 1
68 fi
69 started="registry"
70 pause=0
71 for i in $CONMUX/etc/*.cf
72 do
73 n=${i%.cf}
74 n=${n#$CONMUX/etc/}
75
76 if [scip-shell system . . `[`. "$n" != "*" ]; then
77 if [scip-shell system . . `[`. -f "$CONMUX/log/$n.cf" ]; then
78 if ! cmpscip-shell system . . cmp. -s "$i" "$CONMUX/log/$n.cf"; then
79 stopscip-shell shell conmux 0.12.0-6 stop(). $n
80 fi
81 fi
82 startscip-shell shell conmux 0.12.0-6 start(). $n $CONMUX/sbin/conmux $i
83 if [scip-shell system . . `[`. "$?" -eq 0 ]; then
84 pause=1
85 fi
86 started="$started $n"
87
88 # Preserve the orginal configuration file.
89 cpscip-shell system . . cp. "$i" "$CONMUX/log/$n.cf"
90
91 if grepscip-shell system . . grep. -q TYPE:numaq "$i"; then
92 autoboot="$autoboot $n"
93 fi
94 for i in `grepscip-shell system . . grep. FLAGS: "$i"`; do
95 case "$i" in
96 \#|FLAGS:) ;;
97 *) autoboot="$autoboot $n/$i" ;;
98 esac
99 done
100 fi
101 done
102 if [scip-shell system . . `[`. "$pause" -eq 1 ]; then
103 sleepscip-shell system . . sleep. 1
104 fi
105 for nh in $autoboot
106 do
107 name="${nh%/*}"
108 helper="${nh#*/}"
109
110 mn="${name#abat-}"
111 startscip-shell shell conmux 0.12.0-6 start(). $name-$helper-helper $CONMUX/bin/conmux-attach $mn $helper-helper
112 started="$started $name-$helper-helper"
113 done
114 fi
115
116 if [scip-shell system . . `[`. "$cmd" = "start" -o "$cmd" = "stop" ]; then
117 for i in $existing
118 do
119 case " $started " in
120 *\ $i\ *) ;;
121 *) stopscip-shell shell conmux 0.12.0-6 stop(). "$i" ;;
122 esac
123 done
124 fi
125
126 if [scip-shell system . . `[`. "$cmd" = "status" ]; then
127 for n in $existing
128 do
129 mn="${n#abat-}"
130 case "$n" in
131 registry|*-helper)
132 ;;
133 *)
134 status=`console -s $mn`
135 echoscip-shell system . . echo. "$mn $status"
136 esac
137 done
138 fi