docker-sensors-polling/install.sh
2024-02-04 21:19:01 +01:00

26 lines
505 B
Bash
Executable File

#!/bin/bash
#Absolute path to this script
SCRIPT=$(readlink -f $0)
#Absolute path this script is in
SCRIPTPATH=$(dirname $SCRIPT)
SERVICE="sensors-polling"
cat << EOF > /etc/systemd/system/${SERVICE}.service
[Unit]
Description=Starting ${SERVICE}
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
ExecStart=$SCRIPTPATH/${SERVICE}.py
WorkingDirectory=$SCRIPTPATH
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable ${SERVICE}.service