Add support for online monitoring report
[platform/core/connectivity/net-config.git] / plugin / online-monitor / supp_log_dump.sh
1 #!/bin/sh
2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3
4 #--------------------------------------
5 #   Supplicant Log Dump
6 #--------------------------------------
7
8 # not allow to use relative path
9 if [[ $0 == "/"* ]]; then
10         echo "Absolute path"
11 else
12         echo "Relative path"
13         exit -1
14 fi
15
16 export DISPLAY=:0.0
17
18 SUPP_LOG_FILE=$1
19 SUPP_LOG_SIZE=$(stat -c %s "/opt/usr/data/network/wpa_supplicant.log")
20
21 if [[ SUPP_LOG_SIZE -lt 200000 ]]; then
22 if [[ -f "/opt/usr/data/network/wpa_supplicant.log.0" ]]; then
23     cp /opt/usr/data/network/wpa_supplicant.log.0 ${SUPP_LOG_FILE}
24 fi
25 fi
26
27 cat /opt/usr/data/network/wpa_supplicant.log >> ${SUPP_LOG_FILE}