From 99a25ca4b616dce7a71e457fcded7115c25975fa Mon Sep 17 00:00:00 2001 From: "mcafee%netscape.com" Date: Mon, 31 Jan 2000 20:43:10 +0000 Subject: [PATCH] Cleanup from slamm --- tools/tinderbox/tinderbox | 101 +++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/tools/tinderbox/tinderbox b/tools/tinderbox/tinderbox index 87f4a90fc705..3db842843dd1 100755 --- a/tools/tinderbox/tinderbox +++ b/tools/tinderbox/tinderbox @@ -1,24 +1,24 @@ #!/bin/sh -# +# # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/MPL/ -# +# # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. -# +# # The Original Code is Mozilla Communicator. -# +# # The Initial Developer of the Original Code is Chris McAfee. # Portions created by Chris McAfee are # Copyright (C) The Mozilla Organization. # All Rights Reserved. -# +# # Contributor(s): Chris McAfee -# +# # # Tinderbox control script. @@ -27,6 +27,19 @@ # simultaneously, depend and clobber. # +tinderbox_usage() { + echo "Usage: tinderbox [depend|clobber] {start|stop|status|restart}" + exit 1 +} + +if [ $# != 2 ]; then + echo "Wrong number of arguments." + tinderbox_usage +fi + +build_type="$1" +build_action="$2" + # Depend or clobber build? case "$1" in depend) @@ -36,59 +49,47 @@ case "$1" in treeOption="clobber" ;; *) - echo "Usage: tinderbox [depend|clobber] {start|stop|status|restart}" + tinderbox_usage exit 1 esac # See how we were called. -case "$2" in +case "$build_action" in start) - echo -n "Starting " - echo -n $1 - echo -n " tinderbox..." - if test -f $1.pid; then - echo -n $1 - echo -n " build already running with PID " - cat $1.pid - else - nohup ./build-seamonkey.pl --$treeOption & - echo -n " PID " - echo $! - echo $! > $1.pid - fi - ;; - stop) - echo -n "Shutting down " - echo -n $1 - echo " tinderbox..." - if test -f $1.pid; then - echo "kill -9 `cat $1.pid`" - kill -9 `cat $1.pid` - \rm $1.pid - fi - echo - ;; - status) - if test -f $1.pid; then - echo -n $1 - echo -n " build is running with PID of " - cat $1.pid + echo "Starting $build_type tinderbox..." + if test -f $build_type.pid; then + echo "$build_type build already running with PID "`cat $build_type.pid` else - echo -n $1 - echo " build is not running." + nohup ./build-seamonkey.pl --$build_type & + echo "PID $$" + echo $$ > $build_type.pid fi - ;; + ;; + stop) + echo "Shutting down $build_type tinderbox..." + if test -f $build_type.pid; then + pid=`cat $build_type.pid` + echo "kill $pid" + kill `$pid` + \rm $build_type.pid + fi + echo + ;; + status) + if test -f $build_type.pid; then + echo "$build_type build is running with PID of "`cat $build_type.pid` + else + echo "$build_type build is not running." + fi + ;; restart) - echo -n "Restarting " - echo -n $1 - echo " tinderbox:" - $0 $1 stop - $0 $1 start - ;; + echo "Restarting $build_type tinderbox:" + $0 $build_type stop + $0 $build_type start + ;; *) - echo "Usage: tinderbox [depend|clobber] {start|stop|status|restart}" - exit 1 + tinderbox_usage + exit 1 esac exit 0 -