Score:0

tcpdump file cannot be created through crontab bash file

ve flag

I have two scripts: /home/apps/backup.sh // Just invokes tcpdump.sh /home/apps/tcpdump.sh // Generate a tcpdump file

backup.sh is scheduled by crontab dialy.

backup.sh

#!/bin/sh
/home/apps/tcpdump.sh &

tcpdump.sh

#!/bin/sh
pkill tcpdump
NOWtcpDump=$(date +"%Y%m%d_%H%M%S")
tcpdump -w /var/log/tcpdump/tcpdump.$NOWtcpDump -nn -i ens40 '(dst port 8080)'

crontab -e

0 2 * * *       /home/apps/backup.sh

If I execute /home/apps/backup.sh, manually and it works. Even though, /home/apps/backup.sh is not working well through crontab. I mean, the backup generation is working fine but tcpdump file creation isn't. For some reason, the process of tcpdump.sh get lost.

What is it missing in order to make it works through crontab?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.