forked from ParaStation/pscom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathps_p4sock.sh
executable file
·60 lines (50 loc) · 1.09 KB
/
ps_p4sock.sh
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
#!/bin/sh
#
# p4sock Driver for Parastation4
#
# Script to load/unload the module
#
# Author: Jens Hauke <[email protected]>
#
# $Id$
#
#defaults
PS_BINDIR=${PS_BINDIR-@bindir@}
PSP4STAT=${PS_BINDIR}/p4stat
PSP4TCP=${PS_BINDIR}/p4tcp
case "$1" in
start)
modprobe p4sock || { echo "psmodules_install called? "; exit 1; }
# Try "glue Modules" ignore errors
lsmod |grep -q -e "^e1000" && modprobe e1000_glue > /dev/null 2>&1
lsmod |grep -q -e "^bcm5700" && modprobe bcm5700_glue > /dev/null 2>&1
# Configure p4tcp
if [ "${PS_TCP}" != "" ] ; then
modprobe p4tcp
echo ${PS_TCP}| tr " " "\n"| tr "-" " " | grep -v -e '^$' | while read from to ; do
${PSP4TCP} -a $from $to
done
fi
;;
stop)
# Delete p4tcp config
${PSP4TCP} -d 0.0.0.0 255.255.255.255 > /dev/null 2>&1
rmmod p4tcp > /dev/null 2>&1
rmmod e1000_glue > /dev/null 2>&1
rmmod bcm5700_glue > /dev/null 2>&1
rmmod p4sock
;;
statusheader)
echo
${PSP4STAT} -n | head -1
;;
status)
echo
${PSP4STAT} -n | tail -n +2
;;
*)
echo "Usage: $0 {start|stop|statusheader|status}"
exit 1
;;
esac
exit 0