Operating System - HP-UX
1833792 Members
1996 Online
110063 Solutions
New Discussion

Re: Script for check and enable the printer in HP-UX

 
sanjay.kumar
Occasional Advisor

Script for check and enable the printer in HP-UX

HI Guys


Want help in  checking the below mention Script for check and enable the printer if any any is disable in HP-UX automatic after every half hour......


#!/bin/ksh
# Script To check and enable printers that have gone down.
if [ $# = 1 ]
then
date=`/usr/bin/date`
lpstat $1 | grep Warning > /dev/null 2>&1
if [ $? = 0 ]
then
echo "$1 down at $date" >> /var/tmp/lp/errlog
ps -ef | grep lp >> /var/tmp/lp/$1pslog
tail -50 /var/spool/lp/log >> /var/tmp/lp/$1lplog
tail -50 /var/adm/syslog/syslog.log >> /var/tmp/lp/$1syslog
dmesg >> /var/tmp/lp/$1dmesglog
echo "Cancelling Print Requests for $1" >> /var/tmp/lp/errlog
cancel -a -e -i $1
enable $1
date1=`/usr/bin/date`
echo "$1 brought up at $date1" >> /var/tmp/lp/errlog
else
exit
fi
else
echo Improper Usage
fi

 

 

Thanks...

 

1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Script for check and enable the printer in HP-UX

What type of printers?  Local, remote or networked?