From a9392f024a4f52a796eeaf9cf82b97863450382f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Tue, 28 Jan 2020 14:29:39 +0100 Subject: [PATCH 1/3] Add example launchd service for running OONI Probe automatically every hour You should place the file inside of: `$HOME/Library/LaunchAgents` and then enable by running `launchctl load org.ooni.probe.cli.plist` It assumes you have a `ooniprobe` binary in `~/.ooniprobe/ooniprobe` and a special config file named `/Users/USERNAME/.ooniprobe/config-100sites.json` with a URL limit of 100 sites per run: ``` "nettests": { "websites_url_limit": 100 }, ``` --- scripts/org.ooni.probe.cli.plist | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/org.ooni.probe.cli.plist diff --git a/scripts/org.ooni.probe.cli.plist b/scripts/org.ooni.probe.cli.plist new file mode 100644 index 0000000..306c10b --- /dev/null +++ b/scripts/org.ooni.probe.cli.plist @@ -0,0 +1,34 @@ + + + + + Label + org.ooni.probe.daily-run + + KeepAlive + + RunAtLoad + + + Program + /Users/USERNAME/.ooniprobe/ooniprobe + ProgramArguments + ProgramArguments + + --config="/Users/USERNAME/.ooniprobe/config-100sites.json" + --batch + run + + + StartInterval + 3600 + + StandardErrorPath + /tmp/ooniprobe-cli.err + + StandardOutPath + /tmp/ooniprobe-cli.out + + + + From 1f56f1391f48358b76ad1f0f0dd24309fa758ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Wed, 29 Jan 2020 09:43:39 +0100 Subject: [PATCH 2/3] Move launchd script into the Readme --- Readme.md | 42 ++++++++++++++++++++++++++++++++ scripts/org.ooni.probe.cli.plist | 34 -------------------------- 2 files changed, 42 insertions(+), 34 deletions(-) delete mode 100644 scripts/org.ooni.probe.cli.plist diff --git a/Readme.md b/Readme.md index 7576960..ae0bcae 100644 --- a/Readme.md +++ b/Readme.md @@ -20,6 +20,48 @@ Add a crontab entry (on linux) to run `ooniprobe` daily at a random time: (crontab -l 2>/dev/null; echo "$(( ( RANDOM % 60 ) + 1 )) $(( ( RANDOM % 24 ) + 1 )) * * * ooniprobe run") | crontab - ``` +On macOS you can configure OONI Probe to run automatically using launchd. + +Below is a sample launchd script, that should be placed inside of `~/Library/LaunchAgents/org.ooni.probe.cli.plist`. + +Be sure to replace `/PATH/TO/BINARY/ooniprobe` with the actual install location of the `ooniprobe` binary and `/PATH/TO/CONFIG/config-100sites.json` with the location of a file which limits the testing to 100 URLs. + +You may also want to adjust the locations of the logs. + +``` + + + + + Label + org.ooni.probe.daily-run + + KeepAlive + + RunAtLoad + + + Program + /PATH/TO/BINARY/ooniprobe + ProgramArguments + + --config="/PATH/TO/CONFIG/config-100sites.json" + --batch + run + + + StartInterval + 3600 + + StandardErrorPath + /tmp/ooniprobe-cli.err + + StandardOutPath + /tmp/ooniprobe-cli.out + + +``` + ## Development setup Be sure you have golang >= 1.13. We use golang modules. Run diff --git a/scripts/org.ooni.probe.cli.plist b/scripts/org.ooni.probe.cli.plist deleted file mode 100644 index 306c10b..0000000 --- a/scripts/org.ooni.probe.cli.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Label - org.ooni.probe.daily-run - - KeepAlive - - RunAtLoad - - - Program - /Users/USERNAME/.ooniprobe/ooniprobe - ProgramArguments - ProgramArguments - - --config="/Users/USERNAME/.ooniprobe/config-100sites.json" - --batch - run - - - StartInterval - 3600 - - StandardErrorPath - /tmp/ooniprobe-cli.err - - StandardOutPath - /tmp/ooniprobe-cli.out - - - - From 20084a41b37c2a2d5e9e4375eac631c2644a3c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Wed, 29 Jan 2020 09:45:51 +0100 Subject: [PATCH 3/3] Add launchctl command to Readme --- Readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Readme.md b/Readme.md index ae0bcae..4e15c34 100644 --- a/Readme.md +++ b/Readme.md @@ -62,6 +62,8 @@ You may also want to adjust the locations of the logs. ``` +Once you have written the file, you can enable to run automatically by doing: `launchctl load org.ooni.probe.cli.plist`. + ## Development setup Be sure you have golang >= 1.13. We use golang modules. Run