Skip to content

systemd won't properly run wirerrd collect without execs when forking #1

@mweinelt

Description

@mweinelt
diff --git a/lib/chunks.sh b/lib/chunks.sh
index 2c01b29..42f293f 100644
--- a/lib/chunks.sh
+++ b/lib/chunks.sh
@@ -163,5 +163,5 @@ analyze_chunks() {
 analyze() {
        echo "`date`: Waiting for first chunk"
 
-       inotifywait -q -m "$TMPDIR/raw" -e create -e moved_to | analyze_chunks
+       exec inotifywait -q -m "$TMPDIR/raw" -e create -e moved_to | analyze_chunks
 }
diff --git a/lib/wirerrd-collect.sh b/lib/wirerrd-collect.sh
index 043d944..c1415a5 100755
--- a/lib/wirerrd-collect.sh
+++ b/lib/wirerrd-collect.sh
@@ -10,7 +10,7 @@ THREADS=$((2*`grep -c ^processor /proc/cpuinfo`))
 . ./lib/chunks.sh
 
 run_capture() {
-       dumpcap -q -i "$IFACE" -b duration:60 -w "$TMPDIR/raw/out.cap" 2> /dev/null || {
+       exec dumpcap -q -i "$IFACE" -b duration:60 -w "$TMPDIR/raw/out.cap" 2> /dev/null || {
                echo "Error starting dumpcap" >&2
                kill 0
                exit 1

Additionally the systemd units I'm using:

# /home/hexa/.config/systemd/user/wirerrd-collect.service
[Unit]
Description=wirerrd (collect data)
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/hexa/wirerrd
ExecStart=/home/hexa/wirerrd/wirerrd collect -i ffda-vpn -o data/ffda -f contrib/filters/bcast-stats.rules -j 2

[Install]
WantedBy=multi-user.target
# /home/hexa/.config/systemd/user/wirerrd-export.service
[Unit]
Description=wirerrd (export data)
After=network.target

[Service]
Type=oneshot
WorkingDirectory=/home/hexa/wirerrd
ExecStart=/home/hexa/wirerrd/wirerrd export -i data/ffda -o public_html/ffda
# /home/hexa/.config/systemd/user/wirerrd-export.timer
[Unit]
Description=wirerrd-export timer

[Timer]
OnActiveSec=300
Persistent=true
Unit=wirerrd-export.service

[Install]
WantedBy=basic.target

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions