Created
May 11, 2019 14:02
-
-
Save shyamjos/a553ccf8523f0d34f3e30e7230cd015f to your computer and use it in GitHub Desktop.
Systemd unit file for tcpdump with date filename
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description="Systemd script for tcpdump" | |
After=network.target network-online.target | |
Wants=network-online.target | |
[Service] | |
User=root | |
ExecStart=/bin/bash -lc 'usr/sbin/tcpdump -i eth0 -C 10000 -G 86400 -w /var/log/tcpdumps/tcp_dump_$$(date +%%Y-%%m-%%d-%%H:%%M:%%S).pcap -z gzip -s 0' | |
SuccessExitStatus=143 | |
Restart=on-failure | |
RestartSec=10s | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I tried (and failed !) to do. Thanks a lot
Just because I had the question, I add that -C 10000 means 10Gb, since unit of -C is 1000000