#!/bin/ksh # # SCRIPT: print_UP_Solaris.ksh # # AUTHOR: Randy Michael # DATE: 03/14/2007 # REV: 1.1.P # # PLATFORM: Solaris Only # # PURPOSE: This script is used to enable printing and queuing separately # on each print queue on Solaris systems. # # # REV LIST: # # set -x # Uncomment to debug this script # set -n # Uncomment to check syntax without any execution # ################################################# LOOP=0 # Loop Counter - To grab three lines at a time lpc status all | egrep ':|printing|queueing' | while read LINE do # Load three lines at a time case $LINE in *:) Q=$(echo $LINE | cut -d ':' -f1) ;; printing*) PSTATUS=$(echo $LINE | awk '{print $3}') ;; queueing*) QSTATUS=$(echo $LINE | awk '{print $3}') ;; esac # Increment the LOOP counter (( LOOP = LOOP + 1 )) if ((LOOP == 3)) # Do we have all three lines of data? then # Check printing status case $PSTATUS in disabled) lpc start $Q >/dev/null (($? == 0)) && echo "\n$Q printing re-started\n" ;; enabled|*) : # No-Op - Do Nothing ;; esac # Check queuing status case $QSTATUS in disabled) lpc enable $Q >/dev/null (($? == 0)) && echo "\n$Q queueing re-enabled\n" ;; enabled|*) : # No-Op - Do Nothing ;; esac LOOP=0 # Reset the loop counter to zero fi done