set -e

systemctl stop logs_grabber || true
systemctl stop uniagent || true

cp -f logs_grabber.service /etc/systemd/system/logs_grabber.service
cp -f uniagent.service /etc/systemd/system/uniagent.service
mkdir -p /etc/yandex/unified_agent/ || true
cp -f config.yaml /etc/yandex/unified_agent/config.yml

mkdir -p /root/scripts || true
cp -f logs_grabber /root/scripts/logs_grabber
cp -f unified_agent /root/scripts/unified_agent

systemctl daemon-reload

systemctl start uniagent
