Frist: init code.
This commit is contained in:
commit
d53e4efc4a
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please fill in app's name."
|
||||
exit
|
||||
fi
|
||||
|
||||
mv sdt-cloud-app.service $1.service
|
||||
sudo sed -i "s/sdt-cloud-app/$1/g" ./install.sh
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"topic": "performance",
|
||||
"id": "sdt",
|
||||
"password": "11223344",
|
||||
"host": {
|
||||
"address": "192.168.100.200",
|
||||
"hostname": "sdt"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"hw": "intel",
|
||||
"cpu": 12,
|
||||
"memory": 32,
|
||||
"gpu": "2080TI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
sudo sed -i "s/appName/$1/g" /usr/local/sdt/app/$1/sdt-cloud-app.service
|
||||
sudo cp /usr/local/sdt/app/$1/sdt-cloud-app.service /etc/systemd/system/$1.service
|
||||
sudo systemctl start $1
|
||||
sudo systemctl enable $1
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import paho.mqtt.client as mqtt
|
||||
import json
|
||||
import argparse
|
||||
|
||||
from datetime import datetime
|
||||
import time
|
||||
import yaml
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-config',help='')
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(f'/usr/local/sdt/app/{args.config}/config.json', encoding='UTF-8') as f:
|
||||
jsonData = json.load(f)
|
||||
|
||||
|
||||
# mqttc = mqtt.Client() # puclisher 이름
|
||||
# mqttc.username_pw_set("sdt", "251327")
|
||||
# mqttc.connect("13.209.39.139", 32259)
|
||||
while True:
|
||||
print(f"Config value: {jsonData['topic']}", flush=True)
|
||||
time.sleep(2)
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=sdt-cloud-app
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /usr/local/sdt/app/appName/main.py -config appName
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue