]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Improved detection if buildspy is already running.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Feb 2009 14:47:07 +0000 (15:47 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Feb 2009 14:47:07 +0000 (15:47 +0100)
Added some commands to run buildspy manually.

tools/make-buildspy
tools/make-interactive

index 7ae3591d796b336a3d15cb26aa2f2d7dc15ec817..41d0f0aaca52b41b5b9bb2b32df529afef4f43af 100755 (executable)
@@ -20,6 +20,7 @@
 ###############################################################################
 
 BUILD_SPY_FILENAME=$BASEDIR/.build_spy
+BUILD_SPY_PID=$BUILD_SPY_FILENAME.pid
 
 build_spy() {
        local COMMAND
@@ -48,10 +49,11 @@ build_spy_send_profile() {
 }
 
 if [ "$(basename $0)" == "make-buildspy" ]; then
-       if ps aux | grep -q [m]ake-buildspy; then
-               # Build spy is already running. Exiting silently.
+       if [ -f "$BUILD_SPY_PID" ]; then
                exit 0
        fi
+       echo $$ > $BUILD_SPY_PID
+
        while true; do
                DATA+=$(cat $BUILD_SPY_FILENAME 2>/dev/null || true)
                > $BUILD_SPY_FILENAME
@@ -77,5 +79,5 @@ if [ "$(basename $0)" == "make-buildspy" ]; then
 
                sleep 10
        done
-       rm -f $BUILD_SPY_FILENAME
+       rm -f $BUILD_SPY_FILENAME $BUILD_SPY_PID
 fi
index 2ceb6446890f30e5b1c2dedbd4799453011ca580..1fff16e5de6038ab96891847537a9a6737abff96 100644 (file)
@@ -65,6 +65,21 @@ batch)
        esac
        ;;
 
+buildspy|bs)
+       # control buildspy
+       case "$2" in
+               start)
+                       build_spy start
+                       ;;
+               stop)
+                       build_spy exit
+                       ;;
+               *)
+                       usage
+                       ;;
+       esac
+       ;;
+
 ccache)
        # ccache options
        case "$2" in