The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM



Thread: Unix Script
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-09-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,632
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
I guess the cnt is used outside of your script somewhere ...?

Last edited by era; 04-09-2008 at 11:55 PM. Reason: oops, need basename
Reply With Quote