16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Unix</strong> Administration<br />

/etc/printcap is a table similar to termcap<br />

"lpc"<br />

is used to start and stop <strong>the</strong> printer<br />

/usr/spool/lpd is <strong>the</strong> spool directory<br />

"lpq"<br />

to examine print queue<br />

"lprm"<br />

remove print requests<br />

! SYSTEM V printing<br />

# become lp administrator<br />

su lp<br />

# shutdown printer scheduler<br />

/usr/lib/lpshut<br />

# create a new laser printer on serial port 00<br />

/usr/lib/lpadmin -plaser<br />

-v/dev/term/00 -mhplaser<br />

# copies <strong>the</strong> model hplaser from /usr/spool/lp/model and<br />

renames it<br />

# /usr/spool/lp/interface/laser, this is a script file which you<br />

should edit<br />

# set default print request to <strong>the</strong> epson printer<br />

usr/lib/lpadmin -depson<br />

# start line printer scheduler<br />

/usr/lib/lpsched<br />

# allow request for laser printer to be spooled<br />

/usr/lib/accept laser<br />

# test printer<br />

lp -dlaser filename (laser -1)<br />

# if you protect your directory use<br />

lp -dlaser < filename<br />

# status of print queue<br />

lpstat -t<br />

# paper jam<br />

disable –r"paper jammed" epson<br />

# printer broken<br />

/usr/lib/reject -r"laser printer<br />

gone for repairs" laser<br />

# redirect existing spooled requests<br />

lpmove laser-562 draft<br />

# remove print request<br />

cancel laser-562<br />

# enable printer to process spool<br />

enable laser<br />

! Testing devices<br />

cat /etc/motd > /dev/lp<br />

stty < /dev/tty0l<br />

stty 9600 < /dev/tty0l<br />

ln /dev/tty0l /dev/epson<br />

# display settings<br />

# change settings<br />

lpstart<br />

#!/bin/sh<br />

# lpstart - opposite lpshut<br />

# e.g. /bin/su lp -c "/usr/local/etc/lpstart" &<br />

until [ "$status" = "scheduler is running" ]<br />

do<br />

/usr/lib/lpshut > /dev/null 2>&1<br />

while true<br />

do<br />

line='ps -e | grep lpsched | grep –v grep | head -1'<br />

if [ "$line" ]; <strong>the</strong>n<br />

kill -9 'echo $line | cut -cl-6'<br />

else<br />

break<br />

fi<br />

done<br />

rm /usr/spool/lp/SCHEDLOCK > /dev/null 2>&1<br />

/usr/lib/lpsched<br />

line='ps -e | grep lpsched | grep -v grep'<br />

if [ "$line" ]; <strong>the</strong>n<br />

status='lpstate -r'<br />

196

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!