1

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?

swennemen
  • 131
  • 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 01 '14 at 16:22
  • 1
    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 'SO- stop being evil' Dec 02 '14 at 15:12
  • It was actually running, but not working properly. However, I fixed it using the link @Gilles gave :) – swennemen Dec 09 '14 at 19:54

1 Answers1

2

The command that made it work is:

sudo stdbuf -i0 -o0 -e0 hostapd /etc/hostapd/hostapd.conf | tee log.txt
Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
swennemen
  • 131