Autostart tcpdump does not work

Hello,

I try to autostart tcpdump on a Gl inet AR150 with OpenWRT 23.05.

I try different ways, first was a /etc/init.d/ Script:

#!/bin/sh /etc/rc.common

START=20
STOP=15

start() {
        echo "Start ..."
        tcpdump -i br-lan -w /mnt/`date +%d-%m-%Y--%H-%M-%S`.pcap
}

stop() {
        echo "Stop ..."
        #killall tcpdump
}
root@OpenWrt:~#

The file is executable and I enable the script with /etc/init.t/script enable. But after a reboot tcpdump does not run. If I start the file by hand everything works.

I try also to add the command in the /etc/rc.local, first the command and also try to add the tcpdump to a script-file in /root. But it does not start.

I try also install micrond and put a

@reboot tcpdump -i br-lan -w /mnt/date +%d-%m-%Y--%H-%M-%S.pcap

in the /etc/crontabs/root - but it does not work.

On /mnt is a USB-Stick mounted.

Any ideas?

Found my mistake: the init script starts to early, change

START=20

to

START=97

is the solution.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.