cvs: php-gcov-web /cron cron.sh
| From: | Nuno Lopes | Date: | Fri, 28 Sep 2007 22:58:00 +0000 |
| Subject: | cvs: php-gcov-web /cron cron.sh | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-143@lists.php.net to get a copy of this message | ||
nlopess Fri Sep 28 22:58:00 2007 UTC
Modified files:
/php-gcov-web/cron cron.sh
Log:
make sure that just one copy of the script is running at once, to avoid problems with tests
sharing the same resources
http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/cron.sh?r1=1.4&r2=1.5&diff_format=u
Index: php-gcov-web/cron/cron.sh
diff -u php-gcov-web/cron/cron.sh:1.4 php-gcov-web/cron/cron.sh:1.5
--- php-gcov-web/cron/cron.sh:1.4 Tue Jul 17 15:43:58 2007
+++ php-gcov-web/cron/cron.sh Fri Sep 28 22:58:00 2007
@@ -17,19 +17,33 @@
# | Nuno Lopes <nlopess@php.net> |
# +----------------------------------------------------------------------+
-# $Id: cron.sh,v 1.4 2007/07/17 15:43:58 nlopess Exp $
+# $Id: cron.sh,v 1.5 2007/09/28 22:58:00 nlopess Exp $
source ./config.sh
export LC_ALL=C
export CCACHE_DISABLE=1
# Called either on error or successful completion
-remove_pid_file()
+remove_pid_files()
{
rm -f "$PIDFILE"
+ rm -f "$GLOBALPIDFILE"
}
trap remove_pid_file EXIT
+# the file with the pid of this process
+GLOBALPIDFILE="${PHPROOT}/build.pid"
+
+# check if we are alone. if not, quit.
+if [ -f ${GLOBALPIDFILE} ]; then
+ if ( ps -A | grep
cat "$GLOBALPIDFILE" > /dev/null ); then
+ echo -n "Process already running with PID: "
+ cat ${GLOBALPIDFILE}
+ exit 1
+ fi
+fi
+
+echo $$ > ${GLOBALPIDFILE}
# file that contains the PHP version tags
FILENAME=tags.inc
@@ -149,12 +163,15 @@
php ${WORKDIR}/cron.php ${TMPDIR} ${OUTDIR} ${PHPSRC} ${MAKESTATUS} ${PHPTAG} ${BUILD_TIME}
- remove_pid_file
+ rm -f "$PIDFILE"
fi # End verify build PHP version
done
+remove_pid_files
+
+
# display an error if the tag doesn't exist
if [ $BUILT_SOME = 0 ]; then
echo "Invalid tag specified: '$BUILD'"