#!/bin/sh /etc/rc.common
START=98

boot() {
	stop
	start
}

start() {
	cp "`uci get iec104_multimaster.@iec104_multimaster[0].config_file`" /etc/iec_multimaster.csv
	if  [[ ! `ls /etc/iec_multimaster.csv` ]] || [[ "`ls -l /etc/iec_multimaster.csv  | awk '{print$5}'`" == 0 ]]; then exit ; fi;
	if [ `uci get iec104_multimaster.@iec104_multimaster[0].enable` == 1 ]; then
		/usr/bin/iec60870-driver &> /dev/null &
	fi
}

stop() {
	killall iec60870-driver
	return 0
}
reload() {
	stop
	start
}
