#!/bin/sh
#-------------------------------------------------------------------------
#  Netgear System Software : Package Make File for SOAP AGENT 
#
#  Copyright 2019 Netgear Inc.
#  All Rights Reserved.
#
#  NETGEAR WIRELESS SYSTEM SOFTWARE @ NETGEAR
#  THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND
#  TRADE SECRETS OF NETGEAR INC.
#  USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT
#  THE PRIOR EXPRESS WRITTEN PERMISSION OF NETGEAR INC.
#-------------------------------------------------------------------------

lock -n /tmp/ntgrlog_running &&  (lock -u /tmp/ntgrlog_running;  /sbin/ntgrlog_start & sleep 10)
lock -u /tmp/ntgrlog_running
configs_path=/tmp/ntgrlog/configs
ps | grep -v grep | grep ntgrlog_start | grep -v stop | awk '{print $1}'| xargs kill -9 >/dev/null 2>&1
mkdir -p /tmp/ntgrlog/core_files
mkdir -p $configs_path

cp -rf /var/log/core.* /tmp/ntgrlog/core_files
cp /tmp/log/*.log* /tmp/ntgrlog/
cp /tmp/bitdefender_logs.tar.gz /tmp/ntgrlog/
cp -rf /etc/config/* $configs_path
cp -rf /tmp/*.conf $configs_path
cp -rf /var/run/*.conf $configs_path
