#!/bin/bash
CONF="/etc/speaker.conf"

reboot="$1"

action="$2"

if [ "foo${reboot}" = "footrue" ];then
	if [ "foo${action}" = "fooset_ntp" ];then
		/etc/scripts/shell_action.sh showReboot
		sleep 1
		/sbin/reboot
	fi
fi

/etc/init.d/S49ntp stop

case ${action} in
	set_ntp)
		/etc/init.d/S49ntp start
	;;
	set_manual)
		if [ ! -z "$3" ];then
			manual_time="$3"
			/bin/date -s "${manual_time}" && /sbin/hwclock -w -u
		fi
	;;
esac

/usr/bin/killall clock.sh > /dev/null 2>&1
/etc/scripts/clock.sh > /dev/null 2>&1 &


if [ "foo${reboot}" = "footrue" ];then
	/etc/scripts/shell_action.sh showReboot
	sleep 1
	/sbin/reboot
fi

exit 0