summaryrefslogtreecommitdiff
path: root/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-dhcpd
blob: 575b803c1d26d7abd6eea9504f531747e3c23faa (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
#!/bin/bash

do_start() {
	echo "starting dhcp daemon"
	udhcpd -S /etc/udhcpd.conf
}

do_stop() {
	echo "stopping dhcp daemon"
	killall udhcpd
}

# main
if [[ $# -ne 1 ]]
then
	echo "usage: $0 start|stop|restart"
	exit 1
fi

case $1 in
	start)
		if [[ ! -f "/etc/udhcpd.conf" ]]
		then
			echo "/etc/udhcpd.conf does not exist"
			exit 1
		fi
		do_start
		;;
	stop)
		do_stop
		;;
	restart)
		do_stop
		do_start
		;;
esac

exit 0