Setups
General information
Wirnet™ iBTS information
Wirnet™ iFemtoCell information
Wirnet™ iFemtoCell-evolution information
Wirnet™ iStation information
System management
Network management
LoRa Features
KerOS customization
Support and resources
Setups
General information
Wirnet™ iBTS information
Wirnet™ iFemtoCell information
Wirnet™ iFemtoCell-evolution information
Wirnet™ iStation information
System management
Network management
LoRa Features
KerOS customization
Support and resources
This is an old revision of the document!
When configuring the gateway or when something unusual happens, most of the time, to understand the behaviour of the gateway it is advised to consult the logs. Here is the list of the most useful logs:
/var/log/messages*: These files are the main logs, they gather the traces of the firmware. They contain the boot traces, the network events, the hardware events, and many other traces./var/log/lora.log*: Theses files contain the traces of the common packet forwarder (lorad and lorafwd). If you encounter LoRa issues, this is a good way to start. The verbosity of this log can be increased/decreased. Refer to the log management section./tmp/board_info.json: This file contains information about the hardware of the gateway. It is generated at each boot time./tmp/calib_loraloc.json (for Wirnet iBTS): This file contains the calibration values specific to this gateway. It is generated at boot time./tmp/calib_rf.json (for Wirnet iFemtoCell, Wirnet iFemtoCell-Evolution and Wirnet iStation): This file contains the calibration values specific to this gateway. It is generated at boot time./dev/nmea* (Wirnet iBTS and Wirnet iStation): These devices receive NMEA frames (GPS) every seconds. It can be monitored with the cat command. 
Since Kerlink gateways use a Unix system, most current commands are available (ifconfig, route, ps, iptables, …).
KerOS specific commands:
gsmdiag.py: generates a status of the modem.connmanctl: used to configure/monitor the network manager.opkg list-installed: lists the installed packages.monit status: displays the status of the monitored processes.
The bootcount value is counting the number of reboots since the last power cycle.
At each power loss the counter is reset to 0. The maximum value of this counter is 65535.
The bootcount value can be checked in the file /tmp/board_info.json:
# grep bootcount /tmp/board_info.json "bootcount": 1,
When a gateway is started/restarted, U-Boot displays the boot cause.
The possible reasons are:
This information is transmitted to initrd and to applications with the kernel argument « bootcause ». 
The information is then provided in the bootcause parameter in the file /proc/cmdline. 
Example:
# cat /proc/cmdline console=ttymxc0,115200 bootmode=nominal bootcause=SW bootcount=5 bootfail=0
In case you need assistance to troubleshoot your gateway, Kerlink's support team will help you if:
If the gateway does not satisfy this requirement, please contact sales@kerlink.fr. Our Sales team will make you an offer to get assistance.
Otherwise, contact support@kerlink.fr to get assistance. Our support team will open you an account in Kerlink's ticketing tool.
When contacting the support team, to improve and speed up the resolution of your issue, please provide them:
To simplify the log gathering process, two scripts are available. These scripts generate an archive containing many logs and commands results.
To gather the logs from shell:
/user and issue cd /user).dos2unix gather_logs.sh.chmod 755 gather_logs.sh../gather_logs.sh. The execution of the script takes about 1-2 minutes.#!/bin/sh # Version of the script SCRIPT_VERSION=1.3 # Output directory for the result of the script OUTPUT_DIR="`dirname $0`" # Execution's environment of the script SCRIPT_ENV=unknown # PLATFORM: IBTS, IFEMTO, ISTATION, IFEVO PLATFORM=unknown # Serial number of the product: 39020003 SERIAL=unknown # ETH0 MAC: 70:76:ff:01:77:71 => 7771 SHORT_MAC=unknown # LED paths SYSLEDPATH_4_0_IBTS="/sys/class/leds/yellow:debug" SYSLEDPATH_4_0_IFEMTO="/sys/class/leds/led1:red:power" SYSLEDPATH="/sys/class/leds/status" LED_PATH="/do/not/exist" # Script arguments LEDS_MANAGEMENT=true EXEC_COMMANDS=true # # Print the version of the script # show_version() { echo "Script version: ${SCRIPT_VERSION}" } # # Show help # show_help() { show_version echo -e "Usage: $0 [-h|--help] [-l|--ignore-leds] [-o|--output-dir <directory>] \t-h|--help: this help \t-v|--version: version of the script \t-l|--ignore-leds: this script does not manage the leds (default: autodetection) \t-o|--output-dir <directory>: force the output <directory> to use for extraction (default: current directory) \t-c|--disable-commands: disable diagnosis commands (default: executed) " } # # Compare 2 versions to know if inferior or superior # Res: 0: $1 = $2 # 1: $1 > $2 # 2: $1 < $2 # compare_versions () { if [[ $1 == $2 ]] then return 0 fi local IFS=. local i ver1=($1) ver2=($2) # fill empty fields in ver1 with zeros for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) do ver1[i]=0 done for ((i=0; i<${#ver1[@]}; i++)) do if [[ -z ${ver2[i]} ]] then # fill empty fields in ver2 with zeros ver2[i]=0 fi if ((10#${ver1[i]} > 10#${ver2[i]})) then return 1 fi if ((10#${ver1[i]} < 10#${ver2[i]})) then return 2 fi done return 0 } # # Copy a file or directory if exists # Arguments: # $1: file/directory to copy # $2: destination directory (create if necessary) # copy_if_exists(){ local from="$1" local to="$2" if [ -e "${from}" ] ; then [ ! -d "${to}" ] && mkdir -p "${to}" cp -a "${from}" "${to}" fi } # # Check KerOS/SPN version and stop if: # - KerOS < 4.0 # - SPN < 2.1 # check_fw_version(){ # check if /etc/version exists if [ -a /etc/version ]; then FW_VERSION=$(cat /etc/version) # Detect type of firmware: KerOS or SPN if [[ "${FW_VERSION}" == *-spn-* ]]; then # Check if SPN version is not inferior to 2.1, stop if it is the case compare_versions ${FW_VERSION:0:3} "2.1" if [ $? -eq 2 ]; then echo "Your SPN firmware version ($FW_VERSION) is inferior to v2.1. Please use the adequate script." >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi else # Check if KerOS version is not inferior to 4.0, stop if it is the case compare_versions ${FW_VERSION:0:3} "4.0" if [ $? -eq 2 ]; then echo "Your KerOS firmware version ($FW_VERSION) is inferior to v4. Please use the adequate script." >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi fi else echo "Could not find /etc/version" >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi } # # Check platform we are running on # detect_platform() { PLATFORM="$(fslotpreg getplatform)" if [ $? -ne 0 ]; then PLATFORM="NOT_SUPPORTED" fi echo "Platform detected: ${PLATFORM}" } # # Get product serial number information: SERIAL and SHORT_MAC # fill_serials() { local reg=$(fslotpreg read GP1) if [ $? -eq 0 ]; then SERIAL=$(printf "%X\n" $reg) else SERIAL="unknown" fi SHORT_MAC=$(cat /sys/class/net/eth0/address | awk -F: '{print $5$6}') } # # Detect the type of environment where the script is launched. # Possible environments: # - udev # - shell # detect_env() { # Detection is only based on the presence or not of the variable DEVNAME if [ ! -z ${DEVNAME} ] ; then SCRIPT_ENV=udev exec > /dev/console 2>&1 # Output the script execution in debug console else SCRIPT_ENV=shell LEDS_MANAGEMENT=false OUTPUT_DIR=$(pwd) fi echo "Script environment: ${SCRIPT_ENV}" } # # Detect type of leds depending of platform/firmware version # detect_leds() { if [ -e "${SYSLEDPATH}" ]; then LED_PATH="${SYSLEDPATH}" elif [ -e "${SYSLEDPATH_4_0_IBTS}" ]; then LED_PATH="${SYSLEDPATH_4_0_IBTS}" elif [ -e "${SYSLEDPATH_4_0_IFEMTO}" ]; then LED_PATH="${SYSLEDPATH_4_0_IFEMTO}" fi } # # Set default led behavior # $1: trigger # # if trigger = timer : $2 = delay_on, $3 = delay_off # set_led() { trigger="${1}" on="$2" off="$3" if [ -e "${LED_PATH}" ]; then echo $trigger > "${LED_PATH}/trigger" case "$trigger" in "timer") echo ${on:=500} > "${LED_PATH}/delay_on" echo ${off:=500} > "${LED_PATH}/delay_off" ;; "none") echo ${on:=0} > "${LED_PATH}/brightness" ;; *) # Nothing to do ;; esac fi } # # Execute some diagnosis commands (can take a long time) # execute_commands() { echo "Executing diagnosis commands (can take a long time)" echo -e "\tSystems commands" ( echo -e "\n\n\n************** fslotpreg getplatform *****************" fslotpreg getplatform echo -e "\n\n\n************** fslotpreg fslotpreg read GP1 *****************" fslotpreg read GP1 echo -e "\n\n\n************** date *****************" date echo -e "\n\n\n************** uptime *****************" uptime echo -e "\n\n\n************** ps ww *****************" ps ww echo -e "\n\n\n************** opkg status *****************" opkg status echo -e "\n\n\n************** monit status *****************" monit status echo -e "\n\n\n************** mount *****************" mount ) >> ${tmpdir}/cmd_results.txt echo -e "\tNetwork commands" ( echo -e "\n\n\n************** ifconfig -a *****************" ifconfig -a echo -e "\n\n\n************** gsmdiag.py *****************" gsmdiag.py ; cat /tmp/gsmdiag.txt echo -e "\n\n\n************** route *****************" route echo -e "\n\n\n************** iptables -L *****************" iptables -L echo -e "\n\n\n************** connmanctl technologies *****************" connmanctl technologies echo -e "\n\n\n************** services *****************" connmanctl services if [ -e /dev/cdc-wdm1 ]; then echo -e "\n\n\n************** qmicli get mode *****************" qmicli -d /dev/cdc-wdm1 --nas-get-system-selection-preference fi ) >> ${tmpdir}/network_result.txt # get the 25 last NMEA frames; it will take 10s + 25s if [ -e /dev/nmea2 ]; then echo -e "\tGPS commands" if [ -n "$(lsof | grep $(readlink /dev/nmea2))" ]; then echo " /dev/nmea2 already used by $(lsof | grep $(readlink /dev/nmea2))" > ${tmpdir}/nmea2.log; else timeout -t 10 cat /dev/nmea2 > /dev/null timeout -t 40 head -n 50 /dev/nmea2 > ${tmpdir}/nmea2.log fi fi # Overlay modifications echo -e "\tOverlay commands" overlay diff -l /.rootfs.ro -u /user/.rootfs_upper/ >> ${tmpdir}/overlay_status.txt << EOF yes EOF echo "End of diagnosis commands" } # # Get all the logs, configuration files and commands and save it # in the resquested output directory. # Arguments: # $1: output directory # get_logs() { local output_dir="$1" local name="Logs_${SERIAL}_${SHORT_MAC}_$(date "+%Y%m%d-%H%M%S")" local tmpdir="/tmp/${name}" # system logs echo "Extracting system logs" copy_if_exists /var/log/ ${tmpdir}/var/ # tmp files echo "Extracting tmp files" copy_if_exists /tmp/sys_startup_status.json ${tmpdir}/tmp/ copy_if_exists /tmp/board_info.json ${tmpdir}/tmp/ copy_if_exists /tmp/calib_loraloc.json ${tmpdir}/tmp/ copy_if_exists /tmp/calib_rf.json ${tmpdir}/tmp/ # network configuration echo "Extracting network configuration" copy_if_exists /etc/network/ ${tmpdir}/etc/ copy_if_exists /etc/firewall.d/ ${tmpdir}/etc/ # CPF (lorad + lorafwd) configuration echo "Extracting CPF configuration (if any)" for lorad_dir in /user/etc/lorad /etc/lorad do if [ -d ${lorad_dir} ] ; then echo -e "\tExtracting lorad configuration" copy_if_exists /etc/default/lorad ${tmpdir}/etc/default/ copy_if_exists ${lorad_dir} ${tmpdir}${lorad_dir%/*} fi done for lorafwd_dir in /user/etc/lorafwd /etc/lorafwd do if [ -d ${lorafwd_dir} ] ; then echo -e "\tExtracting lorafwd configuration" copy_if_exists /etc/default/lorafwd ${tmpdir}/etc/default/ copy_if_exists ${lorafwd_dir} ${tmpdir}${lorafwd_dir%/*} fi done # WMC configuration and logs echo "Extracting WMC configuration and logs (if any)" if [ -d /user/bscc ] ; then echo -e "\tExtracting BSCC configuration and logs" copy_if_exists /user/bscc/var.xml ${tmpdir}/user/bscc/ copy_if_exists /user/bscc/traces/ ${tmpdir}/user/bscc/ fi if [ -d /user/snmp ] ; then echo -e "\tExtracting SNMP configuration and logs" copy_if_exists /user/snmp/snmpd.conf ${tmpdir}/user/snmp/ copy_if_exists /user/snmp/traces/ ${tmpdir}/user/snmp/ fi # miscellaneous configuration and logs echo "Extracting miscellaneous configuration and logs" copy_if_exists /etc/rcU.d/ ${tmpdir}/etc/ copy_if_exists /user/.update ${tmpdir}/user/ copy_if_exists /user/.upgrade.log ${tmpdir}/user/ copy_if_exists /user/.sysupgrade.log ${tmpdir}/user/ copy_if_exists /etc/version ${tmpdir}/etc/ copy_if_exists /etc/sysupgrade.conf ${tmpdir}/etc/ copy_if_exists /etc/sysupgrade.d/ ${tmpdir}/etc/ copy_if_exists /etc/.squash_layer_version ${tmpdir}/etc/ echo ${SCRIPT_VERSION} > ${tmpdir}/script_version if ${EXEC_COMMANDS} ; then execute_commands fi echo "Saving all data in ${output_dir}/${name}.tar.gz" tar -C /tmp -czf ${output_dir}/${name}.tar.gz ${name} echo "Done" sync rm -rf $tmpdir } ##################### # MAIN ##################### # Detect the environment of execution of the script detect_env # Manage scripts arguments while [[ $# -gt 0 ]] do key="$1" case $key in -l|--ignore-leds) LEDS_MANAGEMENT=false shift ;; -o|--output-dir) OUTPUT_DIR="$2" shift 2 ;; -c|--disable-commands) EXEC_COMMANDS=false shift ;; -h|--help) show_help shift exit 1 ;; -v|--version) show_version shift exit 1 ;; *) shift ;; esac done # Check if firmware version is compatible check_fw_version # Detect type of platform detect_platform # Fill SERIAL and SHORT_MAC variables fill_serials # Set led On if ${LEDS_MANAGEMENT} ; then detect_leds set_led none 1 fi # Get logs get_logs ${OUTPUT_DIR} # End of script, manage user's notifications if ${LEDS_MANAGEMENT} ; then # Prepare reboot after USB unplug cat > /tmp/usbkey_remove << EOF # Switch off Led echo "none" > ${LED_PATH}/trigger EOF # All is right, make Led blinking fast to notify User set_led timer 100 100 fi
Gathering logs from USB (no commands required)
To gather logs from a USB without typing any command:
usbkey.txt file on the USB key as described here.#!/bin/sh # Version of the script SCRIPT_VERSION=1.3 # Output directory for the result of the script OUTPUT_DIR="`dirname $0`" # Execution's environment of the script SCRIPT_ENV=unknown # PLATFORM: IBTS, IFEMTO, ISTATION, IFEVO PLATFORM=unknown # Serial number of the product: 39020003 SERIAL=unknown # ETH0 MAC: 70:76:ff:01:77:71 => 7771 SHORT_MAC=unknown # LED paths SYSLEDPATH_4_0_IBTS="/sys/class/leds/yellow:debug" SYSLEDPATH_4_0_IFEMTO="/sys/class/leds/led1:red:power" SYSLEDPATH="/sys/class/leds/status" LED_PATH="/do/not/exist" # Script arguments LEDS_MANAGEMENT=true EXEC_COMMANDS=true # # Print the version of the script # show_version() { echo "Script version: ${SCRIPT_VERSION}" } # # Show help # show_help() { show_version echo -e "Usage: $0 [-h|--help] [-l|--ignore-leds] [-o|--output-dir <directory>] \t-h|--help: this help \t-v|--version: version of the script \t-l|--ignore-leds: this script does not manage the leds (default: autodetection) \t-o|--output-dir <directory>: force the output <directory> to use for extraction (default: current directory) \t-c|--disable-commands: disable diagnosis commands (default: executed) " } # # Compare 2 versions to know if inferior or superior # Res: 0: $1 = $2 # 1: $1 > $2 # 2: $1 < $2 # compare_versions () { if [[ $1 == $2 ]] then return 0 fi local IFS=. local i ver1=($1) ver2=($2) # fill empty fields in ver1 with zeros for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) do ver1[i]=0 done for ((i=0; i<${#ver1[@]}; i++)) do if [[ -z ${ver2[i]} ]] then # fill empty fields in ver2 with zeros ver2[i]=0 fi if ((10#${ver1[i]} > 10#${ver2[i]})) then return 1 fi if ((10#${ver1[i]} < 10#${ver2[i]})) then return 2 fi done return 0 } # # Copy a file or directory if exists # Arguments: # $1: file/directory to copy # $2: destination directory (create if necessary) # copy_if_exists(){ local from="$1" local to="$2" if [ -e "${from}" ] ; then [ ! -d "${to}" ] && mkdir -p "${to}" cp -a "${from}" "${to}" fi } # # Check KerOS/SPN version and stop if: # - KerOS < 4.0 # - SPN < 2.1 # check_fw_version(){ # check if /etc/version exists if [ -a /etc/version ]; then FW_VERSION=$(cat /etc/version) # Detect type of firmware: KerOS or SPN if [[ "${FW_VERSION}" == *-spn-* ]]; then # Check if SPN version is not inferior to 2.1, stop if it is the case compare_versions ${FW_VERSION:0:3} "2.1" if [ $? -eq 2 ]; then echo "Your SPN firmware version ($FW_VERSION) is inferior to v2.1. Please use the adequate script." >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi else # Check if KerOS version is not inferior to 4.0, stop if it is the case compare_versions ${FW_VERSION:0:3} "4.0" if [ $? -eq 2 ]; then echo "Your KerOS firmware version ($FW_VERSION) is inferior to v4. Please use the adequate script." >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi fi else echo "Could not find /etc/version" >> ${OUTPUT_DIR}/WRONG_FIRMWARE_VERSION.txt exit fi } # # Check platform we are running on # detect_platform() { PLATFORM="$(fslotpreg getplatform)" if [ $? -ne 0 ]; then PLATFORM="NOT_SUPPORTED" fi echo "Platform detected: ${PLATFORM}" } # # Get product serial number information: SERIAL and SHORT_MAC # fill_serials() { local reg=$(fslotpreg read GP1) if [ $? -eq 0 ]; then SERIAL=$(printf "%X\n" $reg) else SERIAL="unknown" fi SHORT_MAC=$(cat /sys/class/net/eth0/address | awk -F: '{print $5$6}') } # # Detect the type of environment where the script is launched. # Possible environments: # - udev # - shell # detect_env() { # Detection is only based on the presence or not of the variable DEVNAME if [ ! -z ${DEVNAME} ] ; then SCRIPT_ENV=udev exec > /dev/console 2>&1 # Output the script execution in debug console else SCRIPT_ENV=shell LEDS_MANAGEMENT=false OUTPUT_DIR=$(pwd) fi echo "Script environment: ${SCRIPT_ENV}" } # # Detect type of leds depending of platform/firmware version # detect_leds() { if [ -e "${SYSLEDPATH}" ]; then LED_PATH="${SYSLEDPATH}" elif [ -e "${SYSLEDPATH_4_0_IBTS}" ]; then LED_PATH="${SYSLEDPATH_4_0_IBTS}" elif [ -e "${SYSLEDPATH_4_0_IFEMTO}" ]; then LED_PATH="${SYSLEDPATH_4_0_IFEMTO}" fi } # # Set default led behavior # $1: trigger # # if trigger = timer : $2 = delay_on, $3 = delay_off # set_led() { trigger="${1}" on="$2" off="$3" if [ -e "${LED_PATH}" ]; then echo $trigger > "${LED_PATH}/trigger" case "$trigger" in "timer") echo ${on:=500} > "${LED_PATH}/delay_on" echo ${off:=500} > "${LED_PATH}/delay_off" ;; "none") echo ${on:=0} > "${LED_PATH}/brightness" ;; *) # Nothing to do ;; esac fi } # # Execute some diagnosis commands (can take a long time) # execute_commands() { echo "Executing diagnosis commands (can take a long time)" echo -e "\tSystems commands" ( echo -e "\n\n\n************** fslotpreg getplatform *****************" fslotpreg getplatform echo -e "\n\n\n************** fslotpreg fslotpreg read GP1 *****************" fslotpreg read GP1 echo -e "\n\n\n************** date *****************" date echo -e "\n\n\n************** uptime *****************" uptime echo -e "\n\n\n************** ps ww *****************" ps ww echo -e "\n\n\n************** opkg status *****************" opkg status echo -e "\n\n\n************** monit status *****************" monit status echo -e "\n\n\n************** mount *****************" mount ) >> ${tmpdir}/cmd_results.txt echo -e "\tNetwork commands" ( echo -e "\n\n\n************** ifconfig -a *****************" ifconfig -a echo -e "\n\n\n************** gsmdiag.py *****************" gsmdiag.py ; cat /tmp/gsmdiag.txt echo -e "\n\n\n************** route *****************" route echo -e "\n\n\n************** iptables -L *****************" iptables -L echo -e "\n\n\n************** connmanctl technologies *****************" connmanctl technologies echo -e "\n\n\n************** services *****************" connmanctl services if [ -e /dev/cdc-wdm1 ]; then echo -e "\n\n\n************** qmicli get mode *****************" qmicli -d /dev/cdc-wdm1 --nas-get-system-selection-preference fi ) >> ${tmpdir}/network_result.txt # get the 25 last NMEA frames; it will take 10s + 25s if [ -e /dev/nmea2 ]; then echo -e "\tGPS commands" if [ -n "$(lsof | grep $(readlink /dev/nmea2))" ]; then echo " /dev/nmea2 already used by $(lsof | grep $(readlink /dev/nmea2))" > ${tmpdir}/nmea2.log; else timeout -t 10 cat /dev/nmea2 > /dev/null timeout -t 40 head -n 50 /dev/nmea2 > ${tmpdir}/nmea2.log fi fi # Overlay modifications echo -e "\tOverlay commands" overlay diff -l /.rootfs.ro -u /user/.rootfs_upper/ >> ${tmpdir}/overlay_status.txt << EOF yes EOF echo "End of diagnosis commands" } # # Get all the logs, configuration files and commands and save it # in the resquested output directory. # Arguments: # $1: output directory # get_logs() { local output_dir="$1" local name="Logs_${SERIAL}_${SHORT_MAC}_$(date "+%Y%m%d-%H%M%S")" local tmpdir="/tmp/${name}" # system logs echo "Extracting system logs" copy_if_exists /var/log/ ${tmpdir}/var/ # tmp files echo "Extracting tmp files" copy_if_exists /tmp/sys_startup_status.json ${tmpdir}/tmp/ copy_if_exists /tmp/board_info.json ${tmpdir}/tmp/ copy_if_exists /tmp/calib_loraloc.json ${tmpdir}/tmp/ copy_if_exists /tmp/calib_rf.json ${tmpdir}/tmp/ # network configuration echo "Extracting network configuration" copy_if_exists /etc/network/ ${tmpdir}/etc/ copy_if_exists /etc/firewall.d/ ${tmpdir}/etc/ # CPF (lorad + lorafwd) configuration echo "Extracting CPF configuration (if any)" for lorad_dir in /user/etc/lorad /etc/lorad do if [ -d ${lorad_dir} ] ; then echo -e "\tExtracting lorad configuration" copy_if_exists /etc/default/lorad ${tmpdir}/etc/default/ copy_if_exists ${lorad_dir} ${tmpdir}${lorad_dir%/*} fi done for lorafwd_dir in /user/etc/lorafwd /etc/lorafwd do if [ -d ${lorafwd_dir} ] ; then echo -e "\tExtracting lorafwd configuration" copy_if_exists /etc/default/lorafwd ${tmpdir}/etc/default/ copy_if_exists ${lorafwd_dir} ${tmpdir}${lorafwd_dir%/*} fi done # WMC configuration and logs echo "Extracting WMC configuration and logs (if any)" if [ -d /user/bscc ] ; then echo -e "\tExtracting BSCC configuration and logs" copy_if_exists /user/bscc/var.xml ${tmpdir}/user/bscc/ copy_if_exists /user/bscc/traces/ ${tmpdir}/user/bscc/ fi if [ -d /user/snmp ] ; then echo -e "\tExtracting SNMP configuration and logs" copy_if_exists /user/snmp/snmpd.conf ${tmpdir}/user/snmp/ copy_if_exists /user/snmp/traces/ ${tmpdir}/user/snmp/ fi # miscellaneous configuration and logs echo "Extracting miscellaneous configuration and logs" copy_if_exists /etc/rcU.d/ ${tmpdir}/etc/ copy_if_exists /user/.update ${tmpdir}/user/ copy_if_exists /user/.upgrade.log ${tmpdir}/user/ copy_if_exists /user/.sysupgrade.log ${tmpdir}/user/ copy_if_exists /etc/version ${tmpdir}/etc/ copy_if_exists /etc/sysupgrade.conf ${tmpdir}/etc/ copy_if_exists /etc/sysupgrade.d/ ${tmpdir}/etc/ copy_if_exists /etc/.squash_layer_version ${tmpdir}/etc/ echo ${SCRIPT_VERSION} > ${tmpdir}/script_version if ${EXEC_COMMANDS} ; then execute_commands fi echo "Saving all data in ${output_dir}/${name}.tar.gz" tar -C /tmp -czf ${output_dir}/${name}.tar.gz ${name} echo "Done" sync rm -rf $tmpdir } ##################### # MAIN ##################### # Detect the environment of execution of the script detect_env # Manage scripts arguments while [[ $# -gt 0 ]] do key="$1" case $key in -l|--ignore-leds) LEDS_MANAGEMENT=false shift ;; -o|--output-dir) OUTPUT_DIR="$2" shift 2 ;; -c|--disable-commands) EXEC_COMMANDS=false shift ;; -h|--help) show_help shift exit 1 ;; -v|--version) show_version shift exit 1 ;; *) shift ;; esac done # Check if firmware version is compatible check_fw_version # Detect type of platform detect_platform # Fill SERIAL and SHORT_MAC variables fill_serials # Set led On if ${LEDS_MANAGEMENT} ; then detect_leds set_led none 1 fi # Get logs get_logs ${OUTPUT_DIR} # End of script, manage user's notifications if ${LEDS_MANAGEMENT} ; then # Prepare reboot after USB unplug cat > /tmp/usbkey_remove << EOF # Switch off Led echo "none" > ${LED_PATH}/trigger EOF # All is right, make Led blinking fast to notify User set_led timer 100 100 fi