How to keep a script running persistently in background
3
votes
1
answer
859
views
Currently I launch my UDP BitTorrent tracker using the command
./target/release/aquatic_udp -c "aquatic-udp-config.toml"
the app shuts down when I close the console. What is the preferred way of keeping the script running persistently in the background? ChatGPT recommends either
nohup ./target/release/aquatic_udp -c "aquatic-udp-config.toml" &
or systemd
sudo nano /etc/systemd/system/aquatic_udp.service
[Unit]
Description=Aquatic UDP BitTorrent Tracker
After=network.target
[Service]
Type=simple
ExecStart=/path/to/target/release/aquatic_udp -c "/path/to/aquatic-udp-config.toml"
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start aquatic_udp.service
sudo systemctl enable aquatic_udp.service
or using screen
or tmux
. While I'm sure that these will 'work' I'm curious about what knowledgeable people would recommend or what is most suitable for this type of scenario. My gut tells me systemd
is probably the best method for a long term / stability approach?
Asked by skarz
(131 rep)
Apr 30, 2024, 02:26 PM
Last activity: Apr 30, 2024, 02:33 PM
Last activity: Apr 30, 2024, 02:33 PM