FOSSology  4.4.0
Open Source License Compliance by Open Source Software
wait4jobs.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
28 require_once('TestEnvironment.php');
29 require_once('testClasses/check4jobs.php');
30 
31 define("TenMIN", "600");
32 //print "I am:{$argv[0]}\n";
33 
34 $Jq = new check4jobs();
35 
36 /* check every 10 minutes, wait at most 3 hours for test jobs to finish */
37 $done = FALSE;
38 for($i=1; $i<=18; $i++) {
39  //print "DB:W4Q: checking Q...\n";
40  $number = $Jq->Check();
41  if ($number != 0) {
42  //print "sleeping 10 min...\n";
43  sleep(TenMIN);
44  }
45  else {
46  print "no jobs found in the Q:$number\n";
47  $done = TRUE;
48  break;
49  }
50 }
51 if($done === FALSE) {
52  print "{$argv[0]} waited for 2 hours and the jobs are still not done\n" .
53  "Please investigate\n";
54  exit(1);
55 }
56 if($done === TRUE){
57  exit(0);
58 }