![]() |
|
|
|
|
|||||||
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Include PERL script with in the unix shell script | ganapati | UNIX for Dummies Questions & Answers | 1 | 04-29-2008 09:18 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 11:31 AM |
| FTP script for sending a file from one unix directory to another unix server director | raja_1234 | Shell Programming and Scripting | 1 | 11-30-2006 03:57 AM |
| how to convert unix .ksh script to windows .batch script | 2.5lt V8 | Shell Programming and Scripting | 1 | 11-28-2006 08:52 AM |
| check in unix shell script so that no one is able to run the script manually | adi_bang76 | Shell Programming and Scripting | 1 | 11-16-2006 06:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Unix Script
Guys,
I currently have a script that finds print requests older than 1 day and cancels it from the spooler. the script goes like this: ### PRINTERLIST=" hkgwclp0 twapthpc twapthpb 2o2mlj5d Itlaser CIA_Customs sscopslj9 sscopslj2 sscopslj8 fjnanwp1 phmnl9040" for PRINTER in $PRINTERLIST do find /var/spool/lp/request/$PRINTER -mtime +0 if [ $(find /var/spool/lp/request/$PRINTER -mtime +0 | grep "$LOCAL_SERVER" | wc -l) -gt 0 ] then echo "$PRINTER" >> /cia/ciaadm/bin/printer.list /usr/local/bin/canprint $PRINTER let cnt=cnt+1 fi done ## this is just a partial script. i have a few questions: 1. Instead of hardcoding the printer names, how can i just dynamically call the printers from /var/spool/lp/request/$printer-name/?? Is there any other way? 2. How can i break down the find to look for requests older than 1 hour, instead of 1 day? Sorry im a bit of a N00B.... Thanks all! |
| Forum Sponsor | ||
|
|
|
|||
|
If your find is capable enough, it will be able to give you minute granularity. If not, maybe we can develop something here.
If all the entries in /var/spool/lp/requests are the names of printers you want to connect to, and there are none there which you don't want to connect to, just loop over those then? The wc -l is Useless Code:
for PRINTER in /var/spool/lp/request/*
do
if find "$PRINTER" -mmin +60 | grep "$LOCAL_SERVER" >/dev/null
then
echo `basename "$PRINTER"` >> /cia/ciaadm/bin/printer.list
/usr/local/bin/canprint `basename "$PRINTER"`
let cnt=cnt+1
fi
done
Last edited by era; 04-09-2008 at 11:55 PM. Reason: oops, need basename |
|
|||
|
Quote:
but mmin does not work in my version of hp-ux...im getting a "find bad option - mmin" I do not want to complicate things by using touch Is there any other way to break this down? Thanks! |
| Thread Tools | |
| Display Modes | |
|
|