#!/bin/bash

# mining-web-server
systemctl stop mining-web-server 2>/dev/null || true
systemctl disable mining-web-server 2>/dev/null || true
rm -f /etc/systemd/system/mining-web-server.service
systemctl daemon-reload
cp /srv/mmr_cachimba/Antucoya_html/mining-web-server.service /etc/systemd/system/mining-web-server.service
systemctl enable mining-web-server
systemctl restart mining-web-server

# mining-client-mqtt-data
systemctl stop mining-client-mqtt-data 2>/dev/null || true
systemctl disable mining-client-mqtt-data 2>/dev/null || true
rm -f /etc/systemd/system/mining-client-mqtt-data.service
systemctl daemon-reload
cp /srv/mmr_cachimba/client_mqtt_data/mining-client-mqtt-data.service /etc/systemd/system/mining-client-mqtt-data.service
systemctl enable mining-client-mqtt-data
systemctl restart mining-client-mqtt-data

# mediamtx_local
systemctl stop mediamtx_local 2>/dev/null || true
systemctl disable mediamtx_local 2>/dev/null || true
rm -f /etc/systemd/system/mediamtx_local.service
systemctl daemon-reload
cp /srv/mmr_cachimba/mediamtx/mediamtx_local.service /etc/systemd/system/mediamtx_local.service
systemctl enable mediamtx_local
systemctl restart mediamtx_local

# mining-network
systemctl stop mining-network 2>/dev/null || true
systemctl disable mining-network 2>/dev/null || true
rm -f /etc/systemd/system/mining-network.service
systemctl daemon-reload
cp /srv/mmr_cachimba/network/mining-network.service /etc/systemd/system/mining-network.service
systemctl enable mining-network
systemctl restart mining-network
