Project

General

Profile

Bug #2757 » server.sh

Yanbiao Li, 04/22/2015 01:52 PM

 
#!/usr/bin/env bash
log=test.log

usage() {
echo "usage: sh server.sh laptop_ip"
exit 1
}

[ $# -gt 0 ] || usage
echo "laptop ip is $1!" && laptop_ip=$1

pid=$(pgrep -x nfd) && [ "$pid"x != x ] && sudo killall nfd

echo "start NFD" && sudo nohup nfd --config server.nfd.conf >$log 2>&1 &

sleep 2 && echo "register route to laptop" && nfdc register / udp4://$laptop_ip
(7-7/7)