📜 ⬆️ ⬇️

Do you have a lot of different printers in your organization and you need to collect the number of prints from all?

In our company there are 4 offices in each of 3-4 floors, many offices and almost in each there are 1-3 printers and MFPs. An article on how using bash, knowing only the ip-addresses of printers, to automate the assembly of prints from them.

All information is collected in the database, the MAC printer address, serial number and all information on the number of prints are added along the way.



The first script reads all the ip-addresses of the printers from the database, checks them for ping, wakes the kyocera printers, and writes test_ping ok or error to the field, depending on the results of the ping.
')
At this stage it is enough to have only ip addresses of printers in the database.

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 


Kyocera printers

wakeup_kyocera.sh

#! / bin / bash

host = $ 1;

xml = `curl -X POST -s -d '\
<? xml version = "1.0" encoding = "utf-8"?> \
<SOAP-ENV: Envelope \
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: Header> \
<wsa: SOAP-ENV Action: mustUnderstand = "true"> \
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: 9090`;

#echo $ xml

exit 0

The second script searches the database for the ip-addresses of printers that successfully passed the ping and using curl requests the printer model, then it compares the result with the list of models from a separate table in the database. If the result of the request coincides with the list of models, the corresponding ip-address-model is written into the database.

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 


The third script, knowing the model and ip-address, makes the necessary serial number request for a specific model.

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 


The fourth script is also knowing the ip-address and the model makes the appropriate requests to search for information on the number of prints.

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 


To collect the number of prints from Kyocera printers, it turned out to be more convenient to use the additional script kyocera.sh
which I took here from this article and adapted a little.

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 


And the last script that runs all these scripts in the right order.

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 


Database

Maybe someone will say that this is a crutch or a perversion, but it was on these scripts that I studied regular expressions, grep, awk, sed, tr. Many will notice that the regulars are not quite beautiful, but these are working scripts that more or less cope with their tasks.
More or less because not all printers give a serial number or a mac address. In general, this is a good preparation for further development.

PS never figured out how to log in to the web-interface of the printers, so everything that can be pulled out without authorization is pulled out.

A beautiful WEB-interface is requested here, the database contains fields for the address, floor and room number, as well as the path to the network driver disk for each model.

If anyone is interested, join the githaba .

Source: https://habr.com/ru/post/337242/


All Articles