39 lines
588 B
Bash
Executable File
39 lines
588 B
Bash
Executable File
#!/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
|