#!/bin/sh

# We only do anything in here if the interface is set to manual config 
# in /etc/network/interfaces
if [ "$METHOD" == "manual" ]; then
    exec 1>/dev/ttymxc0
    exec 2>/dev/ttymxc0

    # Get the network settings from the netsettings.sh script
    source /app/bin/netsettings.sh

	if [ "$NTP_ENABLED" = "Y" ]; then
		exec 1>/dev/ttymxc0
		exec 2>/dev/ttymxc0
		
		pgrep ntpd >/dev/null
		if [ $? -ne 0 ]; then
			echo S10ntpd: Bringing up ntpd using $NTP_SERVER
			ntpd -p $NTP_SERVER
		else
			echo S10ntpd: ntpd already up
		fi
	fi
fi
