[aiaiai PATCH v3 12/12] systemd: add scripts for running the aiaiai processes

Artem Bityutskiy artem.bityutskiy at linux.intel.com
Fri Feb 7 02:36:23 PST 2014


From: Jacob Keller <jacob.e.keller at intel.com>

This patch adds systemd scripts used for running aiaiai-email-dispatcher, and
for running the aiaiai-watch-queues script. I chose systemd as it is used on
several modern Linux distributions. systemd scripts are relatively easy to
create.

There is a unit file for the dispatcher, and a unit file for the queue
process. I also created a unit file triggered when these units fail, which
causes an email to be sent to an administrator.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
 0 files changed

diff --git a/systemd/aiaiai-email.conf b/systemd/aiaiai-email.conf
new file mode 100644
index 0000000..6c6d3bd
--- /dev/null
+++ b/systemd/aiaiai-email.conf
@@ -0,0 +1,13 @@
+# Default Configuration for aiaiai-email systemd service
+# NOTE: The settings below must exist here, else the systemd service will not be
+# created
+
+# Extra PATH components
+AI_PATH=/usr/local/programs/smatch/bin
+
+# Queue directory to watch
+AI_QUEUE_DIR=/home/aiaiai/work/email/queue
+
+# Validator command
+AI_VALIDATOR=/home/aiaiai/git/aiaiai/email/aiaiai-email-test-patchset --confdir=/home/aiaiai/work/configs --bisectability --sparse --smatch --coccinelle --cppcheck -v /home/aiaiai/work/aiaiai.cfg
+
diff --git a/systemd/aiaiai-email.service b/systemd/aiaiai-email.service
new file mode 100644
index 0000000..8468978
--- /dev/null
+++ b/systemd/aiaiai-email.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Aiaiai Email Dispatcher
+OnFailure=send-mail-on-failure@%n.service
+
+[Service]
+User=aiaiai
+Nice=-5
+EnvironmentFile=/etc/sysconfig/aiaiai-email.conf
+ExecStart=/home/aiaiai/git/aiaiai/email/aiaiai-email-dispatcher -v ${AI_QUEUE_DIR} ${AI_VALIDATOR}
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/aiaiai-queue.conf b/systemd/aiaiai-queue.conf
new file mode 100644
index 0000000..5bf75f8
--- /dev/null
+++ b/systemd/aiaiai-queue.conf
@@ -0,0 +1,22 @@
+# Default Configuration for aiaiai-queue systemd service
+# NOTE: The settings below must exist here, else the systemd service will not be
+# created
+
+# Aiaiai Repository
+AIAIAI_REPO=/home/aiaiai/git/net-next
+
+# Aiaiai Queue Branch
+AIAIAI_BRANCH=aiaiai-queue
+
+# Aiaiai queues to follow
+AIAIAI_QUEUES=ixgbe-queue:ixgb-queue:igb-queue:i40e-queue:e1000e-queue:e1000-queue:e100-queue:core-queue
+
+# Aiaiai remote repository
+AIAIAI_REMOTE=origin
+
+# Aiaiai master branch
+AIAIAI_MASTER=master
+
+# Aiaiai Wait time between check and perform queue creation
+AIAIAI_WAIT_TIME=1m
+
diff --git a/systemd/aiaiai-queue at .service b/systemd/aiaiai-queue at .service
new file mode 100644
index 0000000..2a3c12b
--- /dev/null
+++ b/systemd/aiaiai-queue at .service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Aiaiai %i Queue Watcher
+OnFailure=send-mail-on-failure@%n.service
+
+[Service]
+User=aiaiai
+Nice=-5
+EnvironmentFile=/etc/sysconfig/aiaiai-%i-queue.conf
+ExecStart=/home/aiaiai/git/aiaiai/queue/aiaiai-watch-queue
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
+Alias=multi-user.target/aiaiai-queue at net-next.service
+Alias=multi-user.target/aiaiai-queue at net.service
diff --git a/systemd/send-mail-on-failure.sh b/systemd/send-mail-on-failure.sh
new file mode 100755
index 0000000..3d7283f
--- /dev/null
+++ b/systemd/send-mail-on-failure.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+(
+echo "$1 has crashed, and you need to restart it!"
+echo "Here is the systemctl status output:"
+systemctl status -n 100 "$1"
+) | mutt -s "$1 crashed!" jacob.e.keller at intel.com
diff --git a/systemd/send-mail-on-failure at .service b/systemd/send-mail-on-failure at .service
new file mode 100644
index 0000000..65784e0
--- /dev/null
+++ b/systemd/send-mail-on-failure at .service
@@ -0,0 +1,5 @@
+[Unit]
+Description=Send mail on failure of %i
+[Service]
+User=aiaiai
+ExecStart=/home/aiaiai/git/aiaiai/systemd/send-mail-on-failure.sh %i


-- 
Best Regards,
Artem Bityutskiy




More information about the aiaiai mailing list