Hi all,
I have been asked for a script that at login it prompts for the print queue to restart, restarts it, waits 30 seconds, does an lpstat on it and then logs the user off.
put user in printq group and use Rsh (restricted shell) would be a good way. a user stuck with Rsh as shell cannot cd, so put a link to enq in their home dir. check `man Rsh`, we don't use it.
or write a script (put in root cron) that checks for down queues every 15 minutes, try to bring up say 3 times, then mail or page an admin? avoids having to rely on an operator. might also have a later version do some troubleshooting, like ping and nslookup.
Every time we send a print job to be printed using infoprint on rs6000, we are constently initializing the que's. Any suggestions on a possible config. set up wrong, or what.We have two printers, identical and only the one really acts up.
You can do this a couple ways... with a script.. to restart any queues that might be down ( might be best ).. set a crontab entry
* 0,15,30,45 * * * /usr/local/bin/queue_restart
create the script below .. and save in the /usr/local/bin.. be sure to chmod +x the file so it runs. And don't worry about having to check it too often.. the cron will log each time it has to restart a queue.. and if you're in the .forward for root email .. you should get it in your email when it does..
#!/bin/ksh
# Written by Brofish .. queue_restart
# 6/4/96 DGS
lpstat | grep -i DOWN | awk '{print$1}' > /tmp/queue_reset
printers=`cat /tmp/queue_reset`
# First see that the QDAEMON is running
lssrc -s'qdaemon' > /tmp/qdm
qstat=$(grep active /tmp/qdm | awk '{print $4}')
if [ "$qstat" > "" ]
then
continue
else
startsrc -s'qdaemon'
fi
rm /tmp/qdm
#
for a in $printers
do
qadm -U$a
echo restarting $a
why not use sudo? let the user run only commands he needs. although running a script out of cron to bring up downed queues is faster.
here is a quick and painless q kicker script
#!/bin/ksh
dqueue=`enq -sWA | grep DOWN | cut -f1 -d' '`
for q in $dqueue
do
enq -U -P$q
done
you might want to put some logging in there so you know how many times you have reset each one... Before you criticize someone, you should walk a mile in their shoes. That way you're a mile away and you have their shoes.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.