So & means different things, depending on context.
In the first case:
setsid python script.py < /dev/zero &> log.txt &
the first & used along with > like &> , which means redirecting both stderr and stdout. Last & means run in background
In the second case:
setsid python script.py < /dev/zero & > log.txt &
You only have the first & , which, as stated above, means, but the process is in the background, in this case it setsid python script.py < /dev/zero , which is placed in the background. Then the rest of the line says: do not redirect the process to the log.txt file and do not create it, something like nonsense.
In the third case:
setsid python script.py < /dev/zero > log.txt &
You have & at the end, so all this is put in the background, however your redirect only redirects stdout to log.txt, not stderr, as in the first case.
In the latter case:
setsid python script.py & < /dev/zero > log.txt
You put setsid python script.py in the background and redirect stdout nothing to log.txt and put /dev/zero in stdin nothing.
source share