TCPDUMP - How do I get it to run at startup/boot
by eladZ1i8 from LinuxQuestions.org on (#57EPV)
Greetings every one. We are new to Linux. The entire family changed over to Linux a couple of weeks ago.
In regards to tcpdump.
We want to run the following to display a continuous report of all dns queries:
This works well; however, how do we get it to run automatically when we start a computer.
OS is CentOS8.2.
This is what we use.
mkdir /home/user/Documents/dnslogs
script -q -c "sudo tcpdump -l port 53 2>/dev/null | grep --line-buffered ' A? ' | cut -d' ' -f8" | tee /home/user/Documents/dnslogs/"$(date +"%Y_%m_%d_%I_%M_%p").log"
Help would be greatly appreciated.
thank you
elad


In regards to tcpdump.
We want to run the following to display a continuous report of all dns queries:
This works well; however, how do we get it to run automatically when we start a computer.
OS is CentOS8.2.
This is what we use.
mkdir /home/user/Documents/dnslogs
script -q -c "sudo tcpdump -l port 53 2>/dev/null | grep --line-buffered ' A? ' | cut -d' ' -f8" | tee /home/user/Documents/dnslogs/"$(date +"%Y_%m_%d_%I_%M_%p").log"
Help would be greatly appreciated.
thank you
elad