I'm making a server application and I would like the application to release the terminal and run in the background is that possible in Rust?
I believe a dependency like https://crates.io/crates/daemonize can help with the double-fork process.
thanks that worked
When using systemd it is recommended to not double-fork, but instead let systemd manage it. See daemon(7)
under "New-Style Daemons". Systemd connects stdin to /dev/null
and stdout
/stderr
with systemd-journald. It also sends SIGTERM
directly to the process it started when stopping a service rather than requiring you to specify a stop command which looks for the right double-forked process. Systemd also ensures that the service starts in it's own session leader. According to the man page this is similar but not entirely the same as for macOS daemons.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.