-
Notifications
You must be signed in to change notification settings - Fork 2
/
ovs-start
executable file
·52 lines (49 loc) · 1.06 KB
/
ovs-start
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
#!/bin/bash
exec >ovs-start-stderrout.txt
exec 2>&1
echo "args: $@"
echo
echo "pwd: `/bin/pwd`"
echo
echo "hostname: `hostname`"
echo
# defaults
interval=3
ovs_collect="/usr/bin/ovs-collect"
longopts="interval:"
opts=$(getopt -q -o "" --longoptions "$longopts" -n "getopt.sh" -- "$@");
if [ $? -ne 0 ]; then
printf -- "\tUnrecognized option specified\n\n"
exit 1
fi
eval set -- "$opts";
while true; do
case "$1" in
--interval)
shift;
interval=$1
echo "interval=$interval"
shift;
;;
--)
shift;
break
;;
*)
echo "Invalid option: $1"
exit 1
esac
done
/bin/rm -f ovs-collect-pid.txt
if [ -e $ovs_collect ]; then
$ovs_collect $interval &
ovs_collect_pid=$!
if [ -z "$ovs_collect_pid" ]; then
echo "Could not get ovs-collect PID, exiting"
exit 1
fi
echo "ovs-collect pid is $ovs_collect_pid"
echo $ovs_collect_pid >ovs-collect-pid.txt
else
echo "$ovs_collect is not present, exiting"
fi