Changeset 2614

Show
Ignore:
Timestamp:
01/11/06 20:09:45 (19 years ago)
Author:
jerome
Message:

Integrated Brandon Holbrook's patch to waitprinter.sh to
accept SNMP commmunity and version as parameters.

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/waitprinter.sh

    r2584 r2614  
    3939function printer_status_get() { 
    4040        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` 
    4244} 
    4345#-------------------------------------------------------------------------- 
    4446function printing_wait() { 
    4547        local printer="$1" 
    46         log_msg "CICLE: printing_wait" 
     48        local comm="$2" 
     49        local version="$3" 
     50        log_msg "CYCLE: printing_wait" 
    4751        while [ 1 ]; do 
    48                 printer_status_get "${printer}" 
     52                printer_status_get "${printer}" "${comm}" "${version}" 
    4953                log_msg "${PRINTER_STATUS}" 
    5054                echo "${PRINTER_STATUS}" | grep -iE '(printing)|(idle)' >/dev/null && break 
     
    5559function idle_wait() { 
    5660        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" 
    5864        while [ ${idle_num} -lt ${IDLE_WAIT_NUM} ]; do 
    59                 printer_status_get "${printer}" 
     65                printer_status_get "${printer}" "${comm}" "${version}" 
    6066                log_msg "${PRINTER_STATUS}" 
    6167                idle_flag=0 
     
    7278function main() { 
    7379        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 
    7488        log_msg "BEGIN" 
    7589        ##log_msg "`ls -la /var/spool/{cups,samba}`" 
    7690        log_msg "Pykota Phase: ${PYKOTAPHASE}" 
    7791        if [ x$PYKOTASTATUS != "xCANCELLED" ] && [ x$PYKOTAACTION = "xALLOW" ] && [ x$PYKOTAPHASE = "xAFTER" ] ; then 
    78                 printing_wait "${printer}" 
     92                printing_wait "${printer}" "${comm}" "${version}" 
    7993        fi 
    80         idle_wait "${printer}" #in any case 
     94        idle_wait "${printer}" "${comm}" "${version}" #in any case 
    8195        ##log_msg "`ls -la /var/spool/{cups,samba}`" 
    8296        log_msg "END" 
     
    86100#========================================================================== 
    87101PRINTER_STATUS="" 
    88 main "$1" 
     102main "$1" "$2" "$3" 
    89103exit $? 
  • pykota/trunk/CREDITS

    r2613 r2614  
    241241  - Jamuel P. Starkey - GCI Systems - Secondary MX server. 
    242242  - Kris Kopicki - Walford Anglican School for Girls Inc. - Wrote pykotadmin. 
     243  - Brandon Holbrook - Mississipi State University : improved waitprinter.sh 
    243244 
    244245============================================================== 
  • pykota/trunk/NEWS

    r2609 r2614  
    2424    - 1.24alpha6 : 
    2525     
     26        - Now waitprinter.sh accepts SNMP version number and  
     27          community name as arguments, thanks to Brandon 
     28          Holbrook. 
     29           
    2630        - Now command line errors and Ctrl+C repectively cause 
    2731          PyKota commands to exit with status -2 and -3.