pjs/tools/tinderbox/tinderbox

92 строки
2.2 KiB
Bash
Executable File

#!/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 <mcafee@netscape.com>
#
#
# Tinderbox control script.
#
# Assumes that at most two tinderboxes are running
# 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?
if [ "$build_type" != "depend" -a \
"$build_type" != "clobber" ]; then
echo "Unknown option: $1"
tinderbox_usage
fi
# See how we were called.
case "$build_action" in
start)
if test -f $build_type.pid; then
echo "$build_type build already running with PID "`cat $build_type.pid`
else
echo "Starting $build_type tinderbox..."
nohup ./build-seamonkey.pl --$build_type &
echo "PID $!"
echo $! > $build_type.pid
\rm -f nohup.out
fi
;;
stop)
if test -f $build_type.pid; then
pid=`cat $build_type.pid`
echo "Shutting down $build_type tinderbox, PID = $pid"
kill $pid
\rm $build_type.pid
else
echo "$build_type is not running."
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 "Restarting $build_type tinderbox:"
$0 $build_type stop
$0 $build_type start
;;
*)
tinderbox_usage
exit 1
esac
exit 0