1
0
mirror of https://github.com/fritz-smh/yi-hack synced 2025-06-08 00:16:17 +00:00

Fix missing stuff and add debug logs (activated from config file)

This commit is contained in:
fritz-smh 2016-03-21 21:42:08 +01:00
parent c464d1efc0
commit bb78ea65ec
2 changed files with 39 additions and 9 deletions

View File

@ -45,7 +45,8 @@ led() {
}
LOG_FILE=/home/hd1/test/log.txt
LOG_DIR=/home/hd1/test/
LOG_FILE=${LOG_DIR}/log.txt
log_init() {
# clean the previous log file and add a starting line
@ -76,6 +77,11 @@ get_config() {
# start of our custom script !!!!!!
######################################################
### Launch Telnet server
log "Start telnet server..."
telnetd &
### Get FIRMWARE version
FIRMWARE_VERSION=$(sed -n 's/version=1.8.5.1\(.\)_.*/\1/p' /home/version)
@ -87,7 +93,6 @@ echo "GMT-1" > /etc/TZ
### first, let's do as the orignal script does....
export LD_LIBRARY_PATH=/home/libusr:$LD_LIBRARY_PATH
@ -191,6 +196,7 @@ cp /home/hd1/test/wpa_supplicant.conf /home/wpa_supplicant.conf
log_init
log "The blue led is currently blinking"
log "Firmware version letter = $FIRMWARE_VERSION"
log "Debug mode = $(get_config DEBUG)"
# first, configure wifi
@ -244,6 +250,15 @@ cd /home
sync
### Launch FTP server
log "Start ftp server..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
tcpsvd -vE 0.0.0.0 21 ftpd -w / > /${LOG_DIR}/log_ftp.txt 2>&1 &
else
tcpsvd -vE 0.0.0.0 21 ftpd -w / &
fi
### Launch web server
cd /home/hd1/test/http/
@ -251,7 +266,11 @@ mkdir /home/hd1/test/http/record/
mount -o bind /home/hd1/record/ /home/hd1/test/http/record/
touch /home/hd1/test/http/motion
log "Start http server..."
./server 80 &
if [[ $(get_config DEBUG) == "yes" ]] ; then
./server 80 > /${LOG_DIR}/log_http.txt 2>&1 &
else
./server 80 &
fi
log "Done"
sync
@ -268,7 +287,11 @@ cd /home
### Rtsp server
cd /home/hd1/test/
./rtspsvrM &
if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvrM > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else:
./rtspsvrM &
fi
sleep 5
@ -298,6 +321,8 @@ rm /home/hd1/FSCK*
### Final led color
led $(get_config LED_WHEN_READY)
### List the processes after startup
log "Processes after startup :"
ps >> ${LOG_FILE}
@ -307,4 +332,3 @@ sync

View File

@ -22,3 +22,9 @@ GATEWAY=192.168.1.254
# -boff -yon : yellow on
# -boff -yoff : yellow off
LED_WHEN_READY=-boff -bon
### Debug
# Debug mode, keep it to 'no' unless you known what you do
# Values : yes|no
DEBUG=no