Revision 24368,
1.1 KB
checked in by geofft, 15 years ago
(diff) |
In reactivate:
* Merge reactivate's CUPS-restarting logic, which waits for BrowsePolling to
complete, with debathena-cupsys-config's, which checks to make sure
that cups is running first, and use a common file for both.
In cupsys-config:
* Merge in some of reactivate's CUPS-restarting logic.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | restart_cups() |
---|
2 | { |
---|
3 | # Handle Debian package name change from cupsys to cups. |
---|
4 | [ -e /etc/init.d/cups ] && rcname=cups || rcname=cupsys |
---|
5 | # Restart cupsd if it is running |
---|
6 | if /etc/init.d/$rcname status; then |
---|
7 | if hash invoke-rc.d; then |
---|
8 | invoke="invoke-rc.d $rcname" |
---|
9 | else |
---|
10 | invoke="/etc/init.d/$rcname" |
---|
11 | fi |
---|
12 | # Flush remote.cache to deal with things like changing the |
---|
13 | # server we BrowsePoll against. But don't do so if |
---|
14 | # policy-rc.d is going to prevent us from restarting cupsd |
---|
15 | # (for instance, if reactivate is installed and running; |
---|
16 | # in that case, the next logout will flush remote.cache and restart |
---|
17 | # cupsd anyway). |
---|
18 | if $invoke stop; then |
---|
19 | rm -f /var/cache/cups/remote.cache |
---|
20 | $invoke start |
---|
21 | fi |
---|
22 | |
---|
23 | # Wait up to two minutes to pick up all the BrowsePoll server's queues. |
---|
24 | browse_host="$(sed -ne '/^BrowsePoll/ { s/^BrowsePoll //p; q }' /etc/cups/cupsd.conf)" |
---|
25 | if [ -n "$browse_host" ]; then |
---|
26 | queue_count=$(lpstat -h "$browse_host" -a | wc -l) |
---|
27 | timeout=0 |
---|
28 | while [ $(lpstat -a | wc -l) -lt $queue_count ] && [ $timeout -le 120 ]; do |
---|
29 | sleep 1 |
---|
30 | timeout=$((timeout+1)) |
---|
31 | done |
---|
32 | fi |
---|
33 | fi |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.