mkdir -p /var/log/acp
mkdir -p /mnt/logs/acp

if test -z "`pidof acp_logd`"
then
    /usr/local/acp/bin/acp_logd
fi

if test -z "`pidof acp_logrotated`"
then
    /usr/local/acp/bin/acp_logrotated
fi

if test -z "`pidof acp_hbeat_export`"
then
    /usr/local/acp/bin/acp_hbeat_export
fi

if test -z "`pidof acp_hbeat_collect`"
then
    /usr/local/acp/bin/acp_hbeat_collect
fi

if test -z "`pidof acp_evnt_cntr`"
then
    /usr/local/acp/bin/acp_evnt_cntr
fi

if test -z "`pidof acp_conn_mgrd`"
then
    /usr/local/acp/bin/acp_conn_mgrd
fi

if test -z "`pidof acp_ifd`"
then
    /usr/local/acp/bin/acp_ifd
fi

if test -z "`pidof acp_rstd`"
then
    /usr/local/bin/acp_rstd
fi

if test -z "`pidof acp_discovery`"
then
    /usr/local/acp/bin/acp_discovery
fi

if test -z "`pidof acp_tty2pty`"
then
    /usr/local/acp/bin/acp_tty2pty
fi

if test -f "/mnt/logs/bootcount_p"
then
BOOTCNT_P="`cat /mnt/logs/bootcount_p`"
else
BOOTCNT_P="NONE"
fi

if test -f "/mnt/logs/bootcount_b"
then
BOOTCNT_B="`cat /mnt/logs/bootcount_b`"
else
BOOTCNT_B="NONE"
fi

/usr/local/acp/bin/acp_logger -l "Start of day=`uptime`:bp=`echo $BOOTCNT_P`,bb=`echo $BOOTCNT_B`" -p info
