RT-IPC_camera/etc/ipcamera/boottab

77 lines
1.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
ulimit -s 256
. /etc/sysenv.conf
export PATH="/rtbin:/usr/bin:/usr/sbin:/bin:/sbin:/bin/vs/cgi-bin:/bin/vs:/usr/local/sbin:/usr/local/bin:/rt/bin:/tmpfs"
export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/lib:/rt/lib"
####设置默认开机时间
date -s "2020-01-01 08:00:00"
. ${BOARD_CONF}
BoardType=$boardtype
echo "=== start run boottab ==="
cd /komod && ./load AUTO
echo "start_up" > /proc/rt/led
if [ -x /bin/vslocal/autostartup.sh ];then
/bin/vslocal/autostartup.sh
fi
#start syslogd
syslogd -m 0 -O /tmpfs/syslog.txt -S -s 100 -b 0 &
#log when start
LOGINFO="`date` BOOTTAB: System Start!"
echo "$LOGINFO" >> /tmpfs/syslog.txt
/bin/vs/sysmon.sh &
if [ -x /bin/vs/cgi-bin/net_serv.sh ];then
/bin/vs/cgi-bin/net_serv.sh &
fi
#add hostname
hostname RT-IPC
#start the program of app
cd /bin/vs
logger -t vs "ipcvs_server start !"
file="/bin/vslocal/ipcam"
restartcnt=0
. ${SENSOR_CONF}
SensorType=$sensortype
while [ 1 ]
do
if [ -e "$file" ]
then
./ipcam -sensortype ${SensorType} -boardtype ${BoardType} -restartcnt ${restartcnt}
if [ -e /tmpfs/ipcam.pid ]
then
sleep 10
exit 1
else
restartcnt=`expr $restartcnt + 1`
echo $restartcnt restart
if [ ${restartcnt} -ge 3 ];then
###超过3次都启动失败刷除config分区
config_mtd="/dev/mtd4"
flash_eraseall ${config_mtd}
flashcp /bin/vslocal/config.bin ${config_mtd}
reboot
fi
fi
else
exit 1
fi
done