Every once in a while (not necessarily after resuming from suspend or booting) I have to sudo /etc/init.d/cups restart to see again the network printers. Is there a way to bypass this process, or what is the best way to automate it under Lubuntu 16.04?
1 Answer
For Linux based shell script you can try to schedule script as below:
Crontab entry:
*/5 * * * * sh /scripts/cups_recursive_checking.sh #/bin/sh HOST='server-name' /etc/init.d/cups status>/scripts/cups.txt if grep "cupsd (pid " /scripts/cups.txt then echo "cups is already running" exit else /etc/init.d/cups restart echo "cups just now started in server-name" ############# For mail Notification whenever cups gets restart follow below line according to your email ########## mutt -e "my_hdr Content-Type: text/html" -e 'set realname=Notification' \ -e 'set [email protected]' [email protected] \ -s "CUPS Notification" < /scripts/cups.txt fi ###END OF THE SCRIPT### Example : To check the printers after the cups restart in Linux
lpstat -a clientPrinter accepting requests since Sat 13 Jul 2019 10:07:01 AM IST dmx accepting requests since Sat 13 Jul 2019 03:55:05 PM IST HP_LaserJet_400_M401dw accepting requests since Sat 13 Jul 2019 03:05:06 PM IST
ErrorPolicy. If this is set tostop-printer, the printer que will be stopped when the printer (temporarily) is not reachable, what could happen with network printers. Set this toretry-job, so CUPS won't stop the queue and retry the print job later. See e.g. superuser.com/questions/280396/…lp*commands may indicate what CUPS can see.lpq -lmight do it. I was using Ubuntu 14.04.