Operating System - HP-UX
1753975 Members
7367 Online
108811 Solutions
New Discussion юеВ

How to make Script in HP-UX 11i.23

 
SOLVED
Go to solution
Muhammad Farhan Nasir
Regular Advisor

How to make Script in HP-UX 11i.23

How to make Script in HP-UX 11i.23.

we have printer problem, autometic disable printer.
we have to make script to autometic run on hpux in avery 10 min, for enabling the printer.

please
Muhammad Farhan Nasir
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: How to make Script in HP-UX 11i.23

Hi:

You could create a crontask that runs every 10-minutes that simply does:

#!/usr/bin/sh
/usr/bin/enable printername

In fact, your 'crontab' entry could be as simple as:

0,10,20,30,40,50 * * * * /usr/bin/enable printername

Regards!

...JRF...
AnthonySN
Respected Contributor

Re: How to make Script in HP-UX 11i.23

why not check why the printer is getting disabled ?
maybe you need to use new jetdirect or relevant printer sofware.
Muhammad Farhan Nasir
Regular Advisor

Re: How to make Script in HP-UX 11i.23

Thanks James,

please explain more because i dont know about scripting.

can we enter any Time switch?
Muhammad Farhan Nasir
S.N.S
Valued Contributor

Re: How to make Script in HP-UX 11i.23

Salam Muhammed,

Try:
man crontab

manpages are real useful

HTH
SNS
"Genius is 1% inspiration, 99% Perspiration" - Edison
Michael Sillers
Trusted Contributor
Solution

Re: How to make Script in HP-UX 11i.23

I've had a similar problem with printers over a less than perfect WAN. The printer would drop from the network then the user didn't want to wait for the system to notice it was back so I creqated a script to re-enable it and placed it in /etc/inittab.
The inittab line is:
lpe1:2345:respawn:/etc/enableprinters.sh
The script is:
COUNTER=0
while [ "$COUNTER" -lt 1 ]
do
PRINTERSTOPPED=$(lpstat -p | grep disabled | awk '{print $2}')
if [ -n "$PRINTERSTOPPED" ]
then
lpstat -l | grep disabled | /usr/bin/enable $(awk '{print $2}')
fi
sleep 320
done

It may not be perfect but it works...
Muhammad Farhan Nasir
Regular Advisor

Re: How to make Script in HP-UX 11i.23

Thanks Micheal,
If any one face same problem, so please share the solution.

Thanks & Best Regards
Muhammad Farhan Nasir