From e4313bb7894bf6fa3ce5c4f071db475315860227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brian=20=C3=93=20Donnell?= Date: Thu, 6 Sep 2018 11:57:10 -0400 Subject: [PATCH 1/3] Add example systemd service --- examples/systemd/noisy.service | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/systemd/noisy.service diff --git a/examples/systemd/noisy.service b/examples/systemd/noisy.service new file mode 100644 index 0000000..e46f1cc --- /dev/null +++ b/examples/systemd/noisy.service @@ -0,0 +1,10 @@ +[Unit] +Description=Simple random DNS, HTTP/S internet traffic noise generator + +[Service] +User=noisy +WorkingDirectory=/opt/noisy +ExecStart=/usr/bin/python /opt/noisy/noisy.py --config /opt/noisy/config.json + +[Install] +WantedBy=multi-user.target From aa599294c7e403cec490d0146d9f66db480ce773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brian=20=C3=93=20Donnell?= Date: Fri, 7 Sep 2018 10:25:41 -0400 Subject: [PATCH 2/3] Add instructions for installing the systemd service file --- examples/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/README.md b/examples/README.md index 0c896b9..9d68ffa 100644 --- a/examples/README.md +++ b/examples/README.md @@ -8,3 +8,22 @@ $ cd examples/docker-compose $ docker-compose build $ docker-compose up --scale noisy= ``` + +## Set noisy to run automatically via systemd + +You can use systemd to start noisy.py automatically on every boot. The provided +example service assumes that you have the script copied to /opt/noisy and that +noisy.py and config.json are readable by the 'noisy' user. You can change these +values to suit your needs. + +To configure the service: +``` +$ sudo cp examples/noisy.service /etc/systemd/system +$ sudo systemctl daemon-reload +$ sudo systemctl enable noisy && sudo systemctl start noisy +``` + +You can view the script's output by running: +``` +$ journalctl -f -n noisy +``` From 26244f5510d5f87230ef18c36fe149a01b6ea83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brian=20=C3=93=20Donnell?= Date: Fri, 7 Sep 2018 10:28:26 -0400 Subject: [PATCH 3/3] Fix path to noisy.service file in README.md --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 9d68ffa..c3cdb7e 100644 --- a/examples/README.md +++ b/examples/README.md @@ -18,7 +18,7 @@ values to suit your needs. To configure the service: ``` -$ sudo cp examples/noisy.service /etc/systemd/system +$ sudo cp examples/systemd/noisy.service /etc/systemd/system $ sudo systemctl daemon-reload $ sudo systemctl enable noisy && sudo systemctl start noisy ```