]> git.ipfire.org Git - thirdparty/cups.git/blame - test/waitjobs.sh
Import experimental work-in-progress HTTP/2 branch
[thirdparty/cups.git] / test / waitjobs.sh
CommitLineData
839a51c8
MS
1#!/bin/sh
2#
354aadbe 3# "$Id: waitjobs.sh 1253 2009-02-25 23:37:25Z msweet $"
839a51c8
MS
4#
5# Script to wait for jobs to complete.
6#
b9faaae1 7# Copyright 2008-2009 by Apple Inc.
839a51c8
MS
8#
9# These coded instructions, statements, and computer programs are the
10# property of Apple Inc. and are protected by Federal copyright
11# law. Distribution and use rights are outlined in the file "LICENSE.txt"
12# which should have been included with this file. If this file is
13# file is missing or damaged, see the license at "http://www.cups.org/".
14#
15
b9faaae1 16#
839a51c8 17# Get timeout from command-line
b9faaae1
MS
18#
19
839a51c8
MS
20if test $# = 1; then
21 timeout=$1
22else
b9faaae1
MS
23 timeout=360
24fi
25
26#
27# Figure out the proper echo options...
28#
29
30if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
31 ac_n=-n
32 ac_c=
33else
34 ac_n=
35 ac_c='\c'
839a51c8
MS
36fi
37
b9faaae1
MS
38echo $ac_n "Waiting for jobs to complete...$ac_c"
39oldjobs=0
839a51c8
MS
40
41while test $timeout -gt 0; do
b9faaae1
MS
42 jobs=`../systemv/lpstat 2>/dev/null | wc -l | tr -d ' '`
43 if test $jobs = 0; then
839a51c8
MS
44 break
45 fi
46
b9faaae1
MS
47 if test $jobs != $oldjobs; then
48 echo $ac_n "$jobs...$ac_c"
49 oldjobs=$jobs
50 fi
51
839a51c8
MS
52 sleep 5
53 timeout=`expr $timeout - 5`
54done
55
b9faaae1
MS
56echo ""
57
839a51c8 58#
354aadbe 59# End of "$Id: waitjobs.sh 1253 2009-02-25 23:37:25Z msweet $".
839a51c8 60#