I have modified an open-source program called mosquitto that I run using the command ./mosquitto -c ../mosquitto.conf -v
. The mosquitto program will run indefinitely until you quit it using ctrl+c.
As part of my testing, I want to create a bash script that runs the program and saves all of the logs (which are printed to the screen) to a text file, which it will then parse to determine some statistics. I am redirecting the output to a file as stated on this stackoverflow post, but nothing is being saved (the logs are still print to the terminal). Does anyone know what the issue might be? Is there some other method I could use?
#!/bin/bash
cd ../ && make && cd src
./mosquitto -c ../mosquitto.conf -v >> logs.txt