18 lines
457 B
Bash
18 lines
457 B
Bash
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
|