すべての情報がデータベースに収集され、それに加えて、プリンターモデルにMACアドレス、シリアル番号、および印刷枚数に関するすべての情報が追加されます。
最初のスクリプトは、データベースからプリンターのすべてのIPアドレスを読み取り、pingをチェックし、kyoceraプリンターを起動し、pingの結果に応じてtest_ping okまたはerrorフィールドに書き込みます。
この段階では、データベース内のプリンターのIPアドレスのみがあれば十分です。
Ping.sh
#!/bin/bash ROOT_PATH=$(cd $(dirname $0) && pwd) # , . test="" #test=yes_test # sql='mysql -uprinters_user -pVHBCQpcRO1VIeNsz -Dprinters -e' # , for line in $($sql "SELECT ipaddr FROM all_printers" | awk 'NR>1') do host=$line; # if [ -n "$test" ]; then echo ;fi a=$(ping -c 1 $host | tail -n2 | head -n1 | awk {'print $6'} | sed s/%//) if [ -n "$test" ]; then echo ip $host;fi if [ -n "$test" ]; then echo : $a;fi if [ $a != 0 ] then if [ -n "$test" ]; then echo ;fi $sql "update all_printers set test_ping='error' where ipaddr like '%$host%'" continue fi ${ROOT_PATH}/wakeup_kyocera.sh $host > /dev/null 2>&1; sleep 3 mac=$(arping -c 1 -i eth0 $host | head -n2 | tail -n1 | awk {'print $4'}) $sql "update all_printers set test_ping='ok' where ipaddr like '%$host%'" $sql "update all_printers set mac='$mac' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo ------------------------------------------------------; fi done exit 0
京セラプリンターの目覚まし時計
wakeup_kyocera.sh
#!/ bin / bash
ホスト= $ 1;
xml = `curl -X POST -s -d '\
<?xml version = "1.0" encoding = "utf-8"?> \
<SOAP-ENV:エンベロープ\
xmlns:SOAP-ENV = " www.w3.org/2003/05/soap-envelope " \
xmlns:SOAP-ENC = " www.w3.org/2003/05/soap-encoding " \
xmlns:xsi = " www.w3.org/2001/XMLSchema-instance " \
xmlns:xsd = " www.w3.org/2001/XMLSchema " \
xmlns:wsa = "schemas.xmlsoap.org/ws/2004/08/addressing" \
xmlns:xop = " www.w3.org/2004/08/xop/include " \
xmlns:ns1 = " www.kyoceramita.com/ws/km-wsdl/log/counter_information "> \
<SOAP-ENV:ヘッダー> \
<wsa:アクションSOAP-ENV:mustUnderstand = "true"> \
www.kyoceramita.com/ws/km-wsdl/log/counter_information/get_counter \
</ wsa:アクション> \
</ SOAP-ENV:ヘッダー> \
<SOAP-ENV:ボディ> \
<ns1:get_counterRequest> \
<ns1:counter_type> \
ALL_COUNTER \
</ ns1:counter_type> \
</ ns1:get_counterRequest> \
</ SOAP-ENV:ボディ> \
</ SOAP-ENV:エンベロープ> \
'$ホスト:9090`;
#echo $ xml
出口0
#!/ bin / bash
ホスト= $ 1;
xml = `curl -X POST -s -d '\
<?xml version = "1.0" encoding = "utf-8"?> \
<SOAP-ENV:エンベロープ\
xmlns:SOAP-ENV = " www.w3.org/2003/05/soap-envelope " \
xmlns:SOAP-ENC = " www.w3.org/2003/05/soap-encoding " \
xmlns:xsi = " www.w3.org/2001/XMLSchema-instance " \
xmlns:xsd = " www.w3.org/2001/XMLSchema " \
xmlns:wsa = "schemas.xmlsoap.org/ws/2004/08/addressing" \
xmlns:xop = " www.w3.org/2004/08/xop/include " \
xmlns:ns1 = " www.kyoceramita.com/ws/km-wsdl/log/counter_information "> \
<SOAP-ENV:ヘッダー> \
<wsa:アクションSOAP-ENV:mustUnderstand = "true"> \
www.kyoceramita.com/ws/km-wsdl/log/counter_information/get_counter \
</ wsa:アクション> \
</ SOAP-ENV:ヘッダー> \
<SOAP-ENV:ボディ> \
<ns1:get_counterRequest> \
<ns1:counter_type> \
ALL_COUNTER \
</ ns1:counter_type> \
</ ns1:get_counterRequest> \
</ SOAP-ENV:ボディ> \
</ SOAP-ENV:エンベロープ> \
'$ホスト:9090`;
#echo $ xml
出口0
2番目のスクリプトは、データベースでpingを正常に渡したプリンターのIPアドレスを検索し、curlを使用してプリンターモデルを照会し、結果をデータベース内の別のテーブルのモデルのリストと比較します。 クエリ結果がモデルのリストと一致する場合、ip-address-model一致がデータベースに書き込まれます。
Model.sh
#!/bin/bash sql='mysql -uprinters_user -pVHBCQpcRO1VIeNsz -Dprinters -e' # , ROOT_PATH=$(cd $(dirname $0) && pwd) # , . test="" #test=yes_test # for line in $($sql "SELECT ipaddr FROM all_printers WHERE test_ping not like 'error'" | awk 'NR>1') do host=$line; model=0; if [ -n "$test" ]; then echo ip -- $host;fi # Kyocera name1=$(curl -s http://$host/printer/printersum_top.htm | grep TITLE | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name1 $name1;fi tmp=$($sql "select name from liquid_names where name like '%$name1%'" | awk 'NR>1') if [ "$tmp" == "$name1" ]; then $sql "update all_printers set model='$name1' where ipaddr like '%$host%'"; fi name2=$(curl -s http://$host/status.htm | grep title | head -n1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name2 $name2;fi tmp=$($sql "select name from liquid_names where name like '%$name2%'" | awk 'NR>1') if [ "$tmp" == "$name2" ]; then $sql "update all_printers set model='$name2' where ipaddr like '%$host%'"; fi name3=$(curl -s http://$host/start/start.htm | grep h1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name3 $name3;fi tmp=$($sql "select name from liquid_names where name like '%$name3%'" | awk 'NR>1') if [ "$tmp" == "$name3" ]; then $sql "update all_printers set model='$name3' where ipaddr like '%$host%'"; fi name4=$(curl -s http://$host/eng/start/start.htm | grep h1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name4 $name4;fi tmp=$($sql "select name from liquid_names where name like '%$name4%'" | awk 'NR>1') if [ "$tmp" == "$name4" ]; then $sql "update all_printers set model='$name4' where ipaddr like '%$host%'"; fi name5=$(curl -s http://$host/DeepSleep.js | sed -r 's!^[^"]+!!' | sed -r 's/[)].+//' | sed 's,",,g') if [ -n "$test" ]; then echo name5 $name5;fi tmp=$($sql "select name from liquid_names where name like '%$name5%'" | awk 'NR>1') if [ "$tmp" == "$name5" ]; then $sql "update all_printers set model='$name5' where ipaddr like '%$host%'"; fi name6=$(curl -s http://$host/DeepSleep.js | grep ModelName | sed -r 's!^[^"]+!!' | sed -r 's/[)].+//' | sed 's,",,g') if [ -n "$test" ]; then echo name6 $name6;fi tmp=$($sql "select name from liquid_names where name like '%$name6%'" | awk 'NR>1') if [ "$tmp" == "$name6" ]; then $sql "update all_printers set model='$name6' where ipaddr like '%$host%'"; fi name7=$(curl -s http://$host/startwlm/Start_Wlm.htm | grep HeaderStatusPC | sed -r 's/^[^"]+//' | sed -r 's/,.+//' | sed 's/"//g') if [ -n "$test" ]; then echo name7 $name7;fi tmp=$($sql "select name from liquid_names where name like '%$name7%'" | awk 'NR>1') if [ "$tmp" == "$name7" ]; then $sql "update all_printers set model='$name7' where ipaddr like '%$host%'"; fi # OKI #c610 name8=$(curl -s http://$host/printer/printersum_top.htm | grep TITLE | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name8 $name8;fi tmp=$($sql "select name from liquid_names where name like '%$name8%'" | awk 'NR>1') if [ "$tmp" == "$name8" ]; then $sql "update all_printers set model='$name8' where ipaddr like '%$host%'"; fi #C9655 MC562 name9=$(curl -s http://$host/status.htm | grep title | head -n1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name9 $name9;fi tmp=$($sql "select name from liquid_names where name like '%$name9%'" | awk 'NR>1') if [ "$tmp" == "$name9" ]; then $sql "update all_printers set model='$name9' where ipaddr like '%$host%'"; fi ### HP #HP Designjet 510 name10=$(curl -s http://$host/index_top.htm | grep HP | tail -n1 | sed -r 's/^[ ]+//') if [ -n "$test" ]; then echo name10 $name10;fi tmp=$($sql "select name from liquid_names where name like '%$name10%'" | awk 'NR>1') if [ "$tmp" == "$name10" ]; then $sql "update all_printers set model='$name10' where ipaddr like '%$host%'"; fi # hp LaserJet 2420 name11=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.DeviceInfo | grep span\ \ class\=\"hpPageText\" | head -n2 | tail -n1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') if [ -n "$test" ]; then echo name11 $name11;fi tmp=$($sql "select name from liquid_names where name like '%$name11%'" | awk 'NR>1') if [ "$tmp" == "$name11" ]; then $sql "update all_printers set model='$name11' where ipaddr like '%$host%'"; fi # hp LaserJet 2410 name12=$(curl -s http://$host/index_top.htm | grep hp | tail -n1 | sed -r 's/^[ ]+//') if [ -n "$test" ]; then echo name12 $name12;fi tmp=$($sql "select name from liquid_names where name like '%$name12%'" | awk 'NR>1') if [ "$tmp" == "$name12" ]; then $sql "update all_printers set model='$name12' where ipaddr like '%$host%'"; fi # HP LaserJet P3005 Printers name13=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.Config | grep id\=\"Text4\" | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/>//g') if [ -n "$test" ]; then echo name13 $name13;fi tmp=$($sql "select name from liquid_names where name like '%$name13%'" | awk 'NR>1') if [ "$tmp" == "$name13" ]; then $sql "update all_printers set model='$name13' where ipaddr like '%$host%'"; fi if [ -n "$test" ]; then echo ________________________________________________;fi done exit 0
モデルとIPアドレスを知っている3番目のスクリプトは、特定のモデルのシリアル番号を要求します。
Serial.sh
#!/bin/bash sql='mysql -uprinters_user -pVHBCQpcRO1VIeNsz -Dprinters -e' # , ROOT_PATH=$(cd $(dirname $0) && pwd) # , . test="" #test=yes_test # for line in $($sql "SELECT ipaddr FROM all_printers WHERE test_ping not like 'error'" | awk 'NR>1') do host=$line; model=""; serial=""; # Kyocera FS-1030MFP sql='$sql' model=$($sql "SELECT model FROM all_printers WHERE ipaddr like '%$host%'" | awk 'NR>1') if [ "$model" == "FS-1030MFP" ] || [ "$model" == "FS-1130MFP" ] || [ "$model" == "FS-3920DN" ] || [ "$model" == "FS-6525MFP" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi if [ -n "$test" ]; then echo FS-9530DN FS-1030MFP FS-1130MFP FS-3920DN;fi serial=$(curl -s http://$host/start/start.htm | grep sData'\['8'\]''\ '= | tail -n1 | sed -r 's!^[^"]+!!' | sed -r 's/;.+//' | sed 's,",,g') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi if [ "$model" == "FS-9530DN" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi if [ -n "$test" ]; then echo FS-9530DN FS-1030MFP FS-1130MFP FS-3920DN;fi serial=$(curl -s http://$host/start/start.htm | grep sData\.6.\ \= | sed -r 's!^[^"]+!!' | sed -r 's/;.+//' | sed 's,",,g') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi if [ "$model" == "FS-1320D" ] then if [ -n "$test" ]; then echo model -- $model;fi if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/eng/start/start.htm | grep sData'\['6'\]''\ '= | sed -r 's!^[^"]+!!' | sed -r 's/;.+//' | sed 's,",,g') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi if [ "$model" == "ECOSYS M2530dn" ] || [ "$model" == "ECOSYS M2030dn" ] || [ "$model" == "ECOSYS P6021cdn" ] || [ "$model" == "ECOSYS P2135dn" ] then if [ -n "$test" ]; then echo model -- $model;fi if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/dvcinfo/dvcconfig/DvcConfig_Config.htm | grep ComnAddLabelProperty\(\'2\'\,mes.174.+ | sed -r 's/[^"]+//' | sed -r 's/[": ]//g' | sed -r 's/^.//' | sed -r 's/,.+//') if [ "$serial" == "" ] then ${ROOT_PATH}/wakeup_kyocera.sh $host > /dev/null 2>&1; sleep 30 serial=$(curl -s http://$host/dvcinfo/dvcconfig/DvcConfig_Config.htm | grep ComnAddLabelProperty\(\'2\'\,mes.174.+ | sed -r 's/[^"]+//' | sed -r 's/[": ]//g' | sed -r 's/^.//' | sed -r 's/,.+//') fi $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi ########################### if [ "$model" == "FS-2100DN" ] || [ "$model" == "FS-6525MFP" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/startwlm/DvcConfig_Config.htm | grep sLabel\.nTmp.\ \=\ mes.174 | sed -r 's/[^"]+//' | sed -r 's/[":; ]//g') if [ "$serial" == "" ] then ${ROOT_PATH}/wakeup_kyocera.sh $host > /dev/null 2>&1; sleep 30 serial=$(curl -s http://$host/startwlm/DvcConfig_Config.htm | grep sLabel\.nTmp.\ \=\ mes.174 | sed -r 's/[^"]+//' | sed -r 's/[":; ]//g') fi $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi if [ "$model" == "hp LaserJet 2420" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.DeviceInfo | grep span\ \ class\=\"hpPageText\" | tail -n1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi ## HP LaserJet P3005 if [ "$model" == "HP LaserJet P3005" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.Config | grep id\=\"Text10\" | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/>//g') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" #if [ -n "$test" ]; then echo $serial fi ############################### #OKI if [ "$model" == "C9655" ] || [ "$model" == "MC562" ] || [ "$model" == "C610" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi serial=$(curl -s http://$host/status.htm | grep Serial\ Number\< | grep -Eoi '[az]{2}[0-9]{8}') $sql "update all_printers set serial_nomber='$serial' where ipaddr like '%$host%'" if [ -n "$test" ]; then echo $serial;fi fi if [ -n "$test" ]; then echo _______________________________________________;fi done exit 0
4番目のスクリプトは、IPアドレスとモデルも知っているため、適切なクエリを実行して、印刷部数に関する情報を検索します。
Print.sh
#!/bin/bash sql='mysql -uprinters_user -pVHBCQpcRO1VIeNsz -Dprinters -e' # , ROOT_PATH=$(cd $(dirname $0) && pwd) # , . test="" #test=yes_test # for line in $($sql "SELECT ipaddr FROM all_printers WHERE test_ping not like 'error'" | awk 'NR>1') do host=$line; model=""; serial=""; # Kyocera FS-1030MFP model=$($sql "SELECT model FROM all_printers WHERE ipaddr like '%$host%'" | awk 'NR>1') if [ "$model" == "FS-1030MFP" ] || [ "$model" == "FS-1130MFP" ] || [ "$model" == "FS-3920DN" ] || [ "$model" == "FS-1320D" ] || [ "$model" == "ECOSYS M2530dn" ] || [ "$model" == "ECOSYS M2030dn" ] || [ "$model" == "FS-2100DN" ] || [ "$model" == "ECOSYS P6021cdn" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(${ROOT_PATH}/kyocera.sh $host | sed -n 1p) print_c=$(${ROOT_PATH}/kyocera.sh $host | sed -n 2p) print_p=$(${ROOT_PATH}/kyocera.sh $host | sed -n 3p) if [ "$(echo -n $print_all | wc -c)" -ge "10" ] then print_all="" fi if [ "$(echo -n $print_c | wc -c)" -ge "10" ] then print_c="" fi if [ "$(echo -n $print_p | wc -c)" -ge "10" ] then print_p="" fi $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" $sql "update all_printers set sum_copy='$print_c' where ipaddr like '%$host%'" $sql "update all_printers set sum_printter='$print_p' where ipaddr like '%$host%'" fi if [ "$model" == "FS-3920DN" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(curl -s http://$host/start/start.htm | grep sData\.8.\ \= | sed -r 's!^[^"]+!!' | sed -r 's/;.+//' | sed 's,",,g') $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" fi if [ "$model" == "FS-1320D" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(curl -s http://$host/eng/start/start.htm | grep sData'\['7'\]''\ '= | sed -r 's!^[^"]+!!' | sed -r 's/;.+//' | sed 's,",,g') $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" fi if [ "$model" == "MC562" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(curl -s http://$host/countsum.htm | grep Tray1 | grep -Eoi '[0-9]+' | tail -n1) $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" fi if [ "$model" == "hp LaserJet 2420" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.Usage | grep span\ \ class\=\"hpPageText\" | tail -n1 | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/^\(\)*./\1/') $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" fi if [ "$model" == "HP LaserJet P3005" ] then if [ -n "$test" ]; then echo $model;fi if [ -n "$test" ]; then echo $host;fi print_all=$(curl -s http://$host/hp/device/this.LCDispatcher?nav=hp.Usage | grep id\=\"Text212\" | sed -r 's/^[^>]+//' | sed -r 's/<.+//' | sed 's/>//g') $sql "update all_printers set sum_print_all='$print_all' where ipaddr like '%$host%'" fi if [ -n "$test" ]; then echo $print_all;fi if [ -n "$test" ]; then echo $print_c;fi if [ -n "$test" ]; then echo $print_p;fi if [ -n "$test" ]; then echo ______________________________________________;fi done exit 0
追加のkyocera.shスクリプトを使用して、京セラプリンターから印刷物の数を収集する方が便利でした。
この記事からこれを取り上げて少し改めました。
kyocera.sh
#!/bin/bash # Kyocera Kyocera 2535dn # 2014 , , # mailto:imax.bl@gmail.com # : # accounting_print_black_and_white_copy_counter : / , # accounting_print_black_and_white_printer_counter : / , # accounting_print_black_and_white_fax_counter : / , # accounting_print_duplex_1sided_counter : , # accounting_print_duplex_2sided_counter : , ( = /2) # accounting_print_combine_none_counter : # accounting_print_combine_2in1_counter : , `2 ` ( = * 2) # accounting_print_combine_4in1_counter : , `4 ` ( = * 4) # accounting_scan_fax_counter : , # accounting_scan_copy_counter : , # accounting_scan_other_counter : ( , .) ### device_life_counter : (?) # accounting_print_total_counter : #param=$2; param="accounting_print_total_counter" # , param2="accounting_print_black_and_white_copy_counter" param3="accounting_print_black_and_white_printer_counter" host=$1; port=9090; #echo '$0 = ' $0 #if [[ (-z "$1") || (-z "$2") ]] if [[ (-z "$1") || (-z "accounting_print_total_counter") ]] # , then echo "Usage: $0 10.16.41.149 device_life_counter"; exit 1; fi while [[ ("$result" -eq "0") && ("$cicle" -ne "100") ]] #while [[ (("$result" -eq "0")) -a (("$cicle" -eq "100")) ]] do xml=`curl -X POST -s -d '\ <?xml version="1.0" encoding="utf-8"?>\ <SOAP-ENV:Envelope \ xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"\ xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"\ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\ xmlns:xsd="http://www.w3.org/2001/XMLSchema"\ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"\ xmlns:xop="http://www.w3.org/2004/08/xop/include"\ xmlns:ns1="http://www.kyoceramita.com/ws/km-wsdl/log/counter_information">\ <SOAP-ENV:Header>\ <wsa:Action SOAP-ENV:mustUnderstand="true">\ http://www.kyoceramita.com/ws/km-wsdl/log/counter_information/get_counter\ </wsa:Action>\ </SOAP-ENV:Header>\ <SOAP-ENV:Body>\ <ns1:get_counterRequest>\ <ns1:counter_type>\ ALL_COUNTER\ </ns1:counter_type>\ </ns1:get_counterRequest>\ </SOAP-ENV:Body>\ </SOAP-ENV:Envelope>\ ' $host:$port`; if [[ `echo $xml | grep DEEP_SLEEP_NOW_ERROR` ]] then # echo " , "; sleep 3; else echo $xml > test.log result=`echo $xml | sed "s/.*$param\(.*\)$param.*$/\1/g" | sed "s/[^0-9]//g"` result2=`echo $xml | sed "s/.*$param2\(.*\)$param2.*$/\1/g" | sed "s/[^0-9]//g"` result3=`echo $xml | sed "s/.*$param3\(.*\)$param3.*$/\1/g" | sed "s/[^0-9]//g"` ##### result=`echo $xml` fi #let "cicle = cicle + 1" # - cicle=$(($cicle+1)) #echo " - "$cicle done echo $result echo $result2 echo $result3 exit 0
そして、これらすべてのスクリプトを正しい順序で実行する最後のスクリプト
GO_printers.sh
#!/bin/bash ROOT_PATH=$(cd $(dirname $0) && pwd) # , . # , ! ${ROOT_PATH}/Ping.sh && ${ROOT_PATH}/Model.sh && ${ROOT_PATH}/Serial.sh && ${ROOT_PATH}/Print.sh exit 0
→ データベース
おそらく誰かがこれは松葉杖または倒錯だと言うでしょうが、正規表現、grep、awk、sed、trを研究したのはこれらのスクリプトでした。 多くの人は常連が完全に美しいわけではないことに気付くでしょうが、これらは多かれ少なかれ自分のタスクに対処する作業スクリプトです。
多かれ少なかれ、すべてのプリンターがシリアル番号またはポピーのアドレスを与えるわけではないからです。 一般に、これはさらなる開発のための良い準備です。
PSはプリンターのウェブインターフェースへのログイン方法を把握していなかったため、許可なく引き出し可能なものはすべて引き出しました。
ここでは、美しいWEBインターフェイスが要求されます。データベースには、住所、階数、部屋番号、および各モデルのドライバーを備えたネットワークドライブへのパスのフィールドがあります。
興味がある人は、githubに参加してください 。