blob: 67f631590bdc35ee87acdcda96dc7f654f43e30d (
plain)
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
|
#!/bin/bash
#
# genome-bridge: Network bridge for Genome virtualization
#
# chkconfig: - 15 80
#
# description: Network bridge for Genome virtualization.
#
#
#
# Source function library.
. /etc/init.d/functions
BRIDGE="genomebr0"
case "$1" in
start)
echo -n $"Starting genome-bridge: "
/usr/bin/pkill -f "dhclient eth0"
/usr/bin/pkill -f "dhclient $BRIDGE"
/usr/sbin/brctl addbr $BRIDGE
/sbin/ifconfig eth0 0.0.0.0 promisc up
/usr/sbin/brctl addif $BRIDGE eth0 #TODO: support more than eth0
/sbin/dhclient $BRIDGE #TODO: support static IPs
RETVAL=$?
;;
stop)
echo -n $"Stopping genome-bridge: "
/sbin/ifconfig $BRIDGE down
/sbin/service network restart
/usr/sbin/brctl delbr $BRIDGE
RETVAL=$?
;;
restart)
$0 stop
$0 start
;;
status)
/sbin/ifconfig $BRIDGE &> /dev/null
RETVAL=$?
if [ $RETVAL == 0 ]; then
echo "Bridge is up"
else
echo "Bridge is down"
fi
exit $RETVAL
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=1
esac
exit $RETVAL
|