blob: 4df12d7e9bc0226ca7573d86ae295806eed46a31 [file] [log] [blame]
Junxiao Shid71d84c2014-04-18 17:22:50 -07001#!@BASH@
2
Alexander Afanasyevb47d5382014-05-05 14:35:03 -07003VERSION="@VERSION@"
4
5case "$1" in
6 -h)
7 echo Usage
8 echo $0
9 echo " Start NFD and RIB Management daemon"
10 exit 0
11 ;;
12 -V)
13 echo $VERSION
14 exit 0
15 ;;
16 "") ;; # do nothing
17 *)
18 echo "Unrecognized option $1"
19 exit 1
20 ;;
21esac
22
Junxiao Shid71d84c2014-04-18 17:22:50 -070023hasProcess() {
24 local processName=$1
25
26 if pgrep -x $processName >/dev/null
27 then
28 echo $processName
29 fi
30}
31
32hasNFD=$(hasProcess nfd)
33hasNRD=$(hasProcess nrd)
34
35if [[ -n $hasNFD$hasNRD ]]
36then
37 echo 'NFD or NRD is already running...'
38 exit 1
39fi
40
Junxiao Shi262f5312014-05-03 10:45:12 -070041if ! ndnsec-get-default &>/dev/null
42then
43 ndnsec-keygen /localhost/operator | ndnsec-install-cert -
44fi
45
46if ! sudo true
47then
48 echo 'Unable to obtain superuser privilege'
49 exit 2
50fi
51
Junxiao Shid71d84c2014-04-18 17:22:50 -070052sudo nfd &
53sleep 2
54nrd &
55sleep 2