#!/bin/bash
. /home/zabbix/.bash_profile

export DAY=$(date '+%a')
export TM=$(date '+%H%M')
export PYTHONPIDS=$(pgrep python3)

if [ $TM == 0000 ]
then
 kill $PYTHONPIDS
 rm $HOME/log/fullcycle_$DAY.log
fi

logfile=$HOME/log/fullcycle_$DAY.log

cd $HOME

echo "Start" >> $logfile
echo "Time: $(date)" >> $logfile 
echo "$HOME=" $HOME >> $logfile

bin/zbxdb_starter >> $logfile

sleep 5

cd bin
 ./zbxdb_sender /abs/zabbix/externaltools/zbxdb/zbxora_out 
cd $HOME

echo "Stop" >> $logfile
echo "Time: $(date)" >> $logfile

