Added i2c-amp-control service

This commit is contained in:
2021-12-12 20:23:28 +01:00
parent 9f3e00f093
commit 3744142e49
7 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
npm i
SERVICE="i2c-amp-control"
SERVICE_FOLDER="/data/services/$SERVICE"
mkdir -p "$SERVICE_FOLDER"
cp ./index.js "$SERVICE_FOLDER"
cp -r ./node_modules "$SERVICE_FOLDER"
cp $SERVICE.service /etc/systemd/system
if systemctl list-units | grep "$SERVICE"; then
systemctl restart "$SERVICE.service"
echo "$SERVICE service restarted"
else
systemctl enable "$SERVICE.service"
systemctl start "$SERVICE.service"
echo "Enabled and started $SERVICE"
fi