# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
nanomsg_File="/home/kk/lib/libnanomsg.so.5"
ev_File="/home/kk/lib/libev.so.4"

cd /sbin/
insmod /sbin/ssd1306-revision.ko
/sbin/oled >/dev/null 2>&1 &
sleep 1
export LD_LIBRARY_PATH=/home/kk/lib
cd /home/kk/lib
if [ ! -f "$nanomsg_File" ]; then
	ln libnanomsg.so libnanomsg.so.5
fi
if [ ! -f "$ev_File" ]; then
	ln libev.so libev.so.4
fi

CCU_ID=`cat /etc/dropbear/accessory/hj/hj_ccuid`
/sbin/logread -f -r 120.55.149.201 514 -p /var/run/logread.cloud_log.pid -u -h $CCU_ID >/dev/null 2>&1 &
/sbin/logread -f -e "ccu_err_info" -F /etc/dropbear/accessory/hj/err.log -p /var/run/logread.err_log.pid -S 512 >/dev/null 2>&1 &
sleep 1

/home/kk/run.sh >/dev/null 2>&1 &
sleep 10
/home/kk/process_check.sh >/dev/null 2>&1 &

cd /sbin
/sbin/logd-check.sh >/dev/null 2>&1 &
sleep 1

ntpd -n -q -d -p stdtime.gov.hk &
exit 0
