docker-sensors-polling/install.sh

26 lines
505 B
Bash
Raw Normal View History

2024-02-04 20:19:01 +00:00
#!/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