Automatically add a systemd service to the bash script
Lyamc opened this issue · 0 comments
Lyamc commented
A that would be needed is to add this to the script:
cat << SERVICE_CMD | sudo tee /etc/systemd/system/cloud-torrent.service
[Unit]
Description=Cloud Torrent System Daemon
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/cloud-torrent
StandardOutput=append:/var/log/cloud-torrent.log
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
SERVICE_CMD
This will spit out a ready-to-use service that only needs the user to run:
sudo systemctl enable --now cloud-torrent
Uninstall would be simple:
sudo systemctl disable --now cloud-torrent
sudo rm -f /etc/systemd/system/cloud-torrent.service