#!/bin/bash

go build -o jobarg-monitor -tags=postgres

echo "Killing jobarg-monitor if exist..."
sudo pkill -f jobarg-monitor

echo "Copying binary to /usr/local/bin..."
sudo cp jobarg-monitor /usr/local/bin/jobarg-monitor

sudo chown zabbix:zabbix /usr/local/bin/jobarg-monitor
sudo chmod 777 /usr/local/bin/jobarg-monitor

echo "✅ Installation complete. You can now run 'jobarg-monitor' from anywhere."