Add SystemD Setup tool
This commit is contained in:
+4
-1
@@ -1,3 +1,6 @@
|
||||
config.json
|
||||
devices.json
|
||||
node_modules/
|
||||
node_modules/
|
||||
run.sh
|
||||
watch.sh
|
||||
dec0ntamination.service
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
npm install
|
||||
|
||||
cat <<EOF> run.sh
|
||||
#!/bin/bash
|
||||
cd `pwd`
|
||||
`which node` run.js
|
||||
EOF
|
||||
|
||||
cat <<EOF> watch.sh
|
||||
#!/bin/bash
|
||||
cd `pwd`
|
||||
`which node` watcher.js
|
||||
EOF
|
||||
|
||||
chmod +x run.sh watch.sh
|
||||
|
||||
cat <<EOF> dec0ntamination.service
|
||||
[Unit]
|
||||
Description=Deconz Logger to Influx and Door Chime
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=`pwd`/watch.sh
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
User=1000
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo cp dec0ntamination.service /etc/systemd/system/dec0ntamination.service
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
sudo systemctl enable --now dec0ntamination.service
|
||||
Reference in New Issue
Block a user