Did someone already have a script for this?
Craig E
Did someone already have a script for this?
Craig E
On our 10.5 machines I have them run "cancel -a" at logout.
I am also looking for a nice script that could be run via Self Service to clear all print Queues, or/and clear the permission issues you sometimes get with these printers that then ask for the user to enter an admin username and password.
We support many systems in many buildings so a script that would be helpful is one that can work on any print queue on that system not just specific printers.
Anyone have any ideas?
Thanks
I haven't tested this extensively, but might be a good starting point:
#!/bin/bash
# Cancel all jobs on all destinations and their corresponding data files
cancel -ax
# Cancel all jobs using another method: lprm
lprm -
for printer in $(lpstat -p | awk '{print $2}')
do
# Set the printer to abort stuck jobs from now on
lpadmin -p $P -o printer-error-policy=abort-job
# Cancel all jobs and their corresponding data files
cancel -ax $printer
# Cancel all jobs using another method: lprm
lprm -P $printer
# Cancel jobs and disable CUPS
cupsdisable -c $printer
# Cancel jobs while re-enabling CUPS
cupsenable -c $printer
# Complete the for loop
done
Please run this script once only to disable admin auth prompt asking to resume printers, delete own print jobs etc...After this standard uses will be able to do those tasks without admin privileges.
#!/bin/bash
#
# Enable print operator privileges for everyone to manage printer operations (resume printers, delete print jobs, etc..)
#
/usr/bin/security authorizationdb write system.print.operator allow
exit 0
Run this at logon/logoff/Self Service to remove existing print jobs and re-enable any paused printers.
#! /bin/bash
#
# Remove existing print jobs and re-enable any paused printers
#
# Clearour all exixting print jobs
/usr/bin/cancel -a -
# Find disabled printers
disabledprinters=`/usr/bin/lpstat -p | /usr/bin/grep "disabled" | /usr/bin/awk '{print $2}'`
# Re-enable disabled printers
/usr/sbin/cupsenable $disabledprinters
exit 0
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.