3

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?

0

1 Answer 1

8

the best method ...

This depends on what you want to achieve.

  • Just running in the background this one time: use nohup.
  • Having it run as a service with automatic restart etc: use systemd.
  • Want to run it inside some background terminal so that you can interact with it when needed: use tmux or screen.
2
  • Sorry I now realize that 'best' is entirely subjective. I guess perhaps I was thinking along the lines of what is the "correct" or "appropriate" way to handle something like this.
    – skarz
    Commented Apr 30 at 14:39
  • @skarz: same answer for "correct" and "appropriate" - it depends on what you want to achieve. Commented Apr 30 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .