(SAT) Demo Application - printhosts |
Source Code |
#!/usr/bin/ksh #=====================# # SCRIPTS: printhosts # #=====================# { mysql demo 2>&1 << !SQL select host,serial_no,company,model from host order by host; !SQL } | satreport hosts | lp -d${3} -onobanner -s echo "setMessage {\"Print Request Issued\"}"
Comments |
This script prints summary details for all hosts in the demo database.
Called by: main
{ mysql demo 2>&1 << !SQLThe mysql command is used to access the demo database. All output is directed to standard output so that it will be seen by satreport. SQL satements are read until !SQL.
select host,serial_no,company,model from host order by host;The summary details for the hosts are selected.
!SQL } | satreport hosts | lp -d${3} -onobanner -sThe output from the mysql command is piped to satreport, where it is formatted using the hosts report. The final report is piped to lp. Parameter ${3} is the printer assigned in the users file. The -onobanner option is used to suppress the banner page. The -s flag is used to suppress the notification of the print request ID (This may depend on the Unix variant in use).
NOTE: All standard output from a process is assumed to be SAT/DL commands. Anything else will cause a runtime error in the SATGUI client.
echo "setMessage {\"Print Request Issued\"}"Display a message confirming that the print request has been issued.