mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-01 03:37:50 +08:00
33 lines
636 B
Bash
33 lines
636 B
Bash
#!/bin/bash
|
|
export PATH=$PATH:/usr/local/bin
|
|
workdir=`pwd`
|
|
echo $workdir
|
|
|
|
systemctl stop {{dgiot_td_channel}}
|
|
|
|
rm /usr/lib/systemd/system/{{dgiot_td_channel}}.service -rf
|
|
cat > /lib/systemd/system/{{dgiot_td_channel}}.service << "EOF"
|
|
[Unit]
|
|
Description={{dgiot_td_channel}}_service
|
|
|
|
[Service]
|
|
Type=simple
|
|
ExecStart=/usr/sbin/dgiot_td {{host}} {{channelid}} {{app}}
|
|
ExecReload=/bin/kill -HUP $MAINPID
|
|
KillMode=mixed
|
|
KillSignal=SIGINT
|
|
TimeoutSec=300
|
|
OOMScoreAdjust=-1000
|
|
Restart=on-failure
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable {{dgiot_td_channel}}
|
|
systemctl start {{dgiot_td_channel}}
|
|
|
|
|
|
|