FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
wait4jobs.php
1 #!/usr/bin/php
2 <?php
3 /***********************************************************
4  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 
39 require_once('TestEnvironment.php');
40 require_once('testClasses/check4jobs.php');
41 
42 define("TenMIN", "600");
43 //print "I am:{$argv[0]}\n";
44 
45 $Jq = new check4jobs();
46 
47 /* check every 10 minutes, wait at most 3 hours for test jobs to finish */
48 $done = FALSE;
49 for($i=1; $i<=18; $i++) {
50  //print "DB:W4Q: checking Q...\n";
51  $number = $Jq->Check();
52  if ($number != 0) {
53  //print "sleeping 10 min...\n";
54  sleep(TenMIN);
55  }
56  else {
57  print "no jobs found in the Q:$number\n";
58  $done = TRUE;
59  break;
60  }
61 }
62 if($done === FALSE) {
63  print "{$argv[0]} waited for 2 hours and the jobs are still not done\n" .
64  "Please investigate\n";
65  exit(1);
66 }
67 if($done === TRUE){
68  exit(0);
69 }
70 ?>