- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Printer Issue
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2011 11:34 AM
тАО02-03-2011 11:34 AM
Printer Issue
I have written a script for enabling printers when it is disabled and i have placed in cron for every 30 minutes to check that.
Please see the script for that.
for i in `cat /sys_script/P_list`
do
printerstatus=`lpstat -p\`echo $i\`|awk {'print $5'}`
if [ $printerstatus!= "enabled" ]
then
enable $i
echo "$i printer is enabled on `date`" >> /var/adm/printer/file_log
fi
done
cp /var/adm/printer/file_log /var/adm/printer/file_old1
cp /var/adm/printer/file_old1 /var/adm/printer/file_old2
cp /var/adm/printer/file_old2 /var/adm/printer/file_old3
cp /var/adm/printer/file_old3 /var/adm/printer/file_old4
cp /var/adm/printer/file_old4 /var/adm/printer/file_old5
exit
But now i am gettin an following error for that.
lpstat: printer "qaz0102s" non-existent
/sys_script/P_list[9]: test: Specify a parameter with this command.
lpstat: printer "BOGA_CC" non-existent
/sys_script/P_list[9]: test: Specify a parameter with this command.
lpstat: printer "CLIF_CC" non-existent
/sys_script/P_list[9]: test: Specify a parameter with this command.
lpstat: printer "CLIF_CC" non-existent
/sys_script/P_list[9]: test: Specify a parameter with this command.
lpstat: printer "CLIF_CC" non-existent...
Please see this and do reply since its an urgent issue.
- Tags:
- lpstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2011 01:59 AM
тАО02-05-2011 01:59 AM
Re: Printer Issue
You need to clean it up:
for i in $(< /sys_script/P_list); do
printerstatus=$(lpstat -p $i | awk '{print $5}')
if [ "$printerstatus" != "enabled" ]; then
enable $i
echo "$i printer is enabled on $(date)" >> /var/adm/printer/file_log
fi
done
In particular use $() vs ```. Replace evil cat.
No need for $(echo $i), just use $i.
But most important is fixing quoting and spacing in that "if". And swapping the single quoting vs {} in awk.
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 02:46 PM
тАО02-08-2011 02:46 PM
Re: Printer Issue
I followed the above steps as mentioned by you but still i am getting the errors as printers not found.
Please let me know for a script i which to enable a printers if its disabled actually in HP-UX.
Thanks,
Prabhakar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 04:02 PM
тАО02-08-2011 04:02 PM
Re: Printer Issue
I had to clean up -p spacing and look at only the first line:
for i in $(< /sys_script/P_list); do
printerstatus=$(lpstat -p$i | awk '{print $5; exit}')
if [ "$printerstatus" != "enabled" ]; then
enable $i
echo "$i printer is enabled on $(date)" >> /var/adm/printer/file_log
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2011 01:03 PM
тАО02-09-2011 01:03 PM
Re: Printer Issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-10-2011 02:23 AM - last edited on тАО08-08-2011 11:45 AM by Kevin_Paul
тАО02-10-2011 02:23 AM - last edited on тАО08-08-2011 11:45 AM by Kevin_Paul
Re: Printer Issue
>Thanks a lot for the posting
If you are happy with the answers you were given please read the following about reopening threads and assigning points:
http://h30499.www3.hp.com/t5/help/faqpage/faq-category-id/kudos#kudos