From c341a03404a9466e150cd035b8cf8df6f7158da1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 29 Jun 2008 22:18:39 +0000 Subject: [PATCH] * A little script to test changes to individual Upstart jobs, i.e., only the specified jobs are rebuilt and restarted. Example: $ test/test-upstart-job.sh udev will rebuild and restart just the udev service. This is useful e.g. when making changes to the udev package, which would normally entail rebuilding lots of other services as well (e.g. the X service might depend on KDE, which depends on HAL, which depends on udev...). It's implemented by making a copy of the current /etc/event.d in /tmp/event.d, then replacing only those jobs indicated on the command line, symlinking /etc/event.d to /tmp/event.d, and restarting init. svn path=/nixos/trunk/; revision=12217 --- test/test-upstart-job.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 test/test-upstart-job.sh diff --git a/test/test-upstart-job.sh b/test/test-upstart-job.sh new file mode 100755 index 000000000000..626aed806ae3 --- /dev/null +++ b/test/test-upstart-job.sh @@ -0,0 +1,25 @@ +#! /bin/sh -e + +tmpDir=/tmp/event.d + +rm -rf $tmpDir + +cp -prd $(readlink -f /etc/event.d) /tmp/event.d + +for i in $*; do + echo "building job $i..." + nix-build /etc/nixos/nixos -A "upstartJobs.$i" -o $tmpDir/.result + ln -sfn $(readlink -f $tmpDir/.result)/etc/event.d/* /tmp/event.d/ +done + +ln -sfn /tmp/event.d /etc/event.d + +echo "restarting init..." +kill -TERM 1 + +for i in $*; do + echo "restarting job $i..." + initctl stop "$i" + sleep 1 + initctl start "$i" +done