first commit

This commit is contained in:
이수준 2023-09-06 14:27:32 +09:00
commit 2f800dbdfa
17 changed files with 162 additions and 0 deletions

BIN
bwc-init Executable file

Binary file not shown.

View File

@ -0,0 +1,3 @@
assetcode: acode
devicetype: typecode
mqtturl: tcp://13.209.39.139:32259

BIN
device-control/device-control Executable file

Binary file not shown.

View File

@ -0,0 +1,10 @@
[Unit]
Description=device-control
[Service]
ExecStart=/usr/bin/device-control
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

10
device-control/install.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
sudo mkdir -p /etc/sdt/device-control
sudo cp config.yaml /etc/sdt/device-control
sudo sed -i "s/acode/$1/g" /etc/sdt/device-control/config.yaml
sudo sed -i "s/typecode/$2/g" /etc/sdt/device-control/config.yaml
sudo cp device-control /usr/local/bin/
sudo cp device-control.service /etc/systemd/system/
sudo systemctl start device-control
sudo systemctl enable device-control

View File

@ -0,0 +1,2 @@
assetcode: acode
mqtturl: tcp://13.209.39.139:32259

BIN
device-health/device-health Executable file

Binary file not shown.

View File

@ -0,0 +1,11 @@
[Unit]
Description=DeviceHealth
[Service]
User=root
ExecStart=/usr/bin/device-health
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

9
device-health/install.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
sudo mkdir -p /etc/sdt/device-health
sudo cp config.yaml /etc/sdt/device-health/
sudo sed -i "s/acode/$1/g" /etc/sdt/device-health/config.yaml
sudo cp device-health /usr/bin/
sudo cp device-health.service /etc/systemd/system/
sudo systemctl start device-health
sudo systemctl enable device-health

BIN
heartbeat/device-heartbeat Executable file

Binary file not shown.

View File

@ -0,0 +1,11 @@
[Unit]
Description=DeviceHearthBeat
[Service]
User=root
ExecStart=/usr/bin/device-heartbeat
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

6
heartbeat/install.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo cp device-heartbeat /usr/bin/
sudo cp device-heartbeat.service /etc/systemd/system/
sudo systemctl start device-heartbeat
sudo systemctl enable device-heartbeat

42
init.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
set -e
if [ $(id -u) -ne 0 ]; then
echo "Please run as root. - sudo su"
exit
elif [ $1 == "help" ]; then
echo "Please input parameter. follow as:"
echo "Example) Organzation ID=58a311aa-f52a-40e3-af44-cdec82b9d0b7 SerialNumbe=ECN-SJ-TEST-001 Type=ecn"
exit
fi
echo "If you need help, please enter follow as:"
echo "./init.sh help"
read -p "Organzation ID(58a311aa-f52a-40e3-af44-cdec82b9d0b7): " oid
read -p "Serial Number(ECN-SJ-TEST-001): " acode
read -p "Type(ecn or nodeq): " etype
echo "[INIT] [1] Start equipment registration"
./bwc-init -oid=$oid -acode=$acode
echo "[INIT] [1] Finish equipment registration"
echo "[INIT] [2] Start install device-control"
cd device-control
./install.sh $acode $etype
echo "[INIT] [2] Finish install device-control"
echo "[INIT] [3] Start install device-health"
cd ../device-health
./install.sh $acode
echo "[INIT] [3] Finish install device-health"
echo "[INIT] [4] Start install device-heartbeat"
cd ../heartbeat
./install.sh
echo "[INIT] [4] Finish install device-heartbeat"
echo "[INIT] [5] Start install process-checker"
cd ../process-checker
./install.sh
echo "[INIT] [5] Stop install process-checker"

6
process-checker/install.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo cp process-checker /usr/bin/
sudo cp process-checker.service /etc/systemd/system/
sudo systemctl start process-checker
sudo systemctl enable process-checker

BIN
process-checker/process-checker Executable file

Binary file not shown.

View File

@ -0,0 +1,11 @@
[Unit]
Description=processchecker
[Service]
User=root
ExecStart=/usr/bin/process-checker
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

41
uninstall.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
set -e
if [ $(id -u) -ne 0 ]; then
echo "Please run as root. - sudo su"
exit
fi
echo "[INIT] Start uninstall device-control"
systemctl disable device-control
systemctl stop device-control
rm /etc/systemd/system/device-control.service
rm /usr/local/bin/device-control
rm -rf /etc/sdt/device-control
echo "[INIT] Finish uninstall device-control"
echo "[INIT] Start uninstall device-health"
systemctl disable device-health
systemctl stop device-health
rm /etc/systemd/system/device-health.service
rm /usr/local/bin/device-health
rm -rf /etc/sdt/device-health
echo "[INIT] Finish uninstall device-health"
echo "[INIT] Start uninstall device-heartbeat"
systemctl disable device-heartbeat
systemctl stop device-heartbeat
rm /etc/systemd/system/device-heartbeat.service
rm /usr/local/bin/device-heartbeat
echo "[INIT] Finish uninstall device-heartbeat"
echo "[INIT] Start uninstall process-checker"
systemctl disable process-checker
systemctl stop process-checker
rm /etc/systemd/system/process-checker.service
rm /usr/local/bin/process-checker
echo "[INIT] Finish uninstall process-checker"
echo "[INIT] Delete Cert Data"
rm -rf /etc/sdt/cert