Changeset 2614
- Timestamp:
- 01/11/06 20:09:45 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/waitprinter.sh
r2584 r2614 39 39 function printer_status_get() { 40 40 local printer="$1" 41 PRINTER_STATUS=`snmpget -v1 -c public -Ov ${printer} HOST-RESOURCES-MIB::hrPrinterStatus.1` 41 local comm="$2" 42 local version="$3" 43 PRINTER_STATUS=`snmpget -v${version} -c ${comm} -Ov ${printer} HOST-RESOURCES-MIB::hrPrinterStatus.1` 42 44 } 43 45 #-------------------------------------------------------------------------- 44 46 function printing_wait() { 45 47 local printer="$1" 46 log_msg "CICLE: printing_wait" 48 local comm="$2" 49 local version="$3" 50 log_msg "CYCLE: printing_wait" 47 51 while [ 1 ]; do 48 printer_status_get "${printer}" 52 printer_status_get "${printer}" "${comm}" "${version}" 49 53 log_msg "${PRINTER_STATUS}" 50 54 echo "${PRINTER_STATUS}" | grep -iE '(printing)|(idle)' >/dev/null && break … … 55 59 function idle_wait() { 56 60 local printer="$1" idle_num=0 idle_flag=0 57 log_msg "CICLE: idle_wait" 61 local comm="$2" 62 local version="$3" 63 log_msg "CYCLE: idle_wait" 58 64 while [ ${idle_num} -lt ${IDLE_WAIT_NUM} ]; do 59 printer_status_get "${printer}" 65 printer_status_get "${printer}" "${comm}" "${version}" 60 66 log_msg "${PRINTER_STATUS}" 61 67 idle_flag=0 … … 72 78 function main() { 73 79 local printer="$1" 80 local comm="$2" 81 local version="$3" 82 if [ x${comm} == "x" ]; then 83 comm="public" 84 fi 85 if [ x${version} == "x" ]; then 86 version="1" 87 fi 74 88 log_msg "BEGIN" 75 89 ##log_msg "`ls -la /var/spool/{cups,samba}`" 76 90 log_msg "Pykota Phase: ${PYKOTAPHASE}" 77 91 if [ x$PYKOTASTATUS != "xCANCELLED" ] && [ x$PYKOTAACTION = "xALLOW" ] && [ x$PYKOTAPHASE = "xAFTER" ] ; then 78 printing_wait "${printer}" 92 printing_wait "${printer}" "${comm}" "${version}" 79 93 fi 80 idle_wait "${printer}" #in any case94 idle_wait "${printer}" "${comm}" "${version}" #in any case 81 95 ##log_msg "`ls -la /var/spool/{cups,samba}`" 82 96 log_msg "END" … … 86 100 #========================================================================== 87 101 PRINTER_STATUS="" 88 main "$1" 102 main "$1" "$2" "$3" 89 103 exit $? -
pykota/trunk/CREDITS
r2613 r2614 241 241 - Jamuel P. Starkey - GCI Systems - Secondary MX server. 242 242 - Kris Kopicki - Walford Anglican School for Girls Inc. - Wrote pykotadmin. 243 - Brandon Holbrook - Mississipi State University : improved waitprinter.sh 243 244 244 245 ============================================================== -
pykota/trunk/NEWS
r2609 r2614 24 24 - 1.24alpha6 : 25 25 26 - Now waitprinter.sh accepts SNMP version number and 27 community name as arguments, thanks to Brandon 28 Holbrook. 29 26 30 - Now command line errors and Ctrl+C repectively cause 27 31 PyKota commands to exit with status -2 and -3.