1

This question already has an answer here:

I'm running hostapd on my raspberry PI to let it function as an accesspoint. It's working fine with the following command:

sudo hostapd /etc/hostapd/hostapd.conf

This will start hostapd and log all output to the console. Now I want to log this output using TEE or pipe. However, one the following commands will cause the program not to start.

sudo hostapd /etc/hostapd/hostapd.conf >> /home/pi/Desktop/loggin.txt sudo hostapd /etc/hostapd/hostapd.conf > /home/pi/Desktop/loggin.txt sudo hostapd /etc/hostapd/hostapd.conf | tee log.txt

The terminal will just hang and I have to use ctrl-x to terminate. Why isn't this working? And how can I possibly fix this?

marked as duplicate by Gilles, slm Dec 9 '14 at 20:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    does sudo anything work that way? It should, but different sudo configs might not allow that if the terminal is not their outfile. And are you sure it is just hanging and not actually working? – mikeserv Dec 1 '14 at 16:22
  • What makes you think that the program isn't started? If it's only because you don't see any output, this could be because the program is executing normally, but its output is buffered, so the output appears only in relatively large chunks. Try unbuffer: sudo unbuffer /etc/hostapd/hostapd.conf | tee log.txt, do you see output now? – Gilles Dec 2 '14 at 15:12
  • It was actually running, but not working properly. However, I fixed it using the link @Gilles gave :) – swennemen Dec 9 '14 at 19:54
2

The command that made it work is:

sudo stdbuf -i0 -o0 -e0 hostapd /etc/hostapd/hostapd.conf | tee log.txt

Not the answer you're looking for? Browse other questions tagged or ask your own question.