I've read and understood about how you create a daemon process, but from everything I read I never really understood why it needs to be done.
I've read that we do the fork - setsid - fork to avoid the process to gain control of a terminal, but what does this mean ? If I start a program in the background using & (for example './script &' ), what makes this process' execution different than if I ran normally a program that turns itself into a daemon ?
Does this simply mean that if I logout the background process will stop and the daemon will keep running ? I'm really having trouble understanding the 'gain control of a terminal' thing.
The reason this bothers me is because I'm working on an embedded RPi on a robot and I thus need to make programs start on boot.
Currently I'm just starting them from rc.local with a command like this
su user -c 'python /home/user/launcher.py &' &.
I've never had any problem with the program starting on boot (I can even see the process using
ps -e when SSHing to the RPi), but I would like to know if there's any risk / if it's bad practice.