IT/Procedures/Printer Maintenance/Script to prevent printhead drying out

From msgwiki
< IT‎ | Procedures
Revision as of 14:52, 18 May 2024 by Stefan (talk | contribs)
Jump to navigation Jump to search

Printer Maintenance Script

About the Issue

A lot of effort has been taken by several people to create a reliable script that prints a test page on all printers every few days.

This should prevent the ink drying out which renders the printer unusable.

So far this feat has not been fully achieved yet :(

How is it setup?

  • the script runs every few days as a cron job on the cnx server
  • several scripts are under /home/walt/.scripts/PrinterMaintenance
  • crontab -e to check which one is active at the moment
  • the newer ones are set to create some logs in the same folder (*.log)
  • most if not all scripts try to print with lp and check somewhat with lpstat what's around (printers and/or open print jobs)

What is working so far

  • there's a script that prints over the access point mode of the printers
    • caveat is that the printer need to be set to ap mode, then back again for normal use
    • so far this was used as a "holiday setup"
  • the other scripts try to print over wlan connected to the router
    • this seems to work "mostly" well, at least with the MG3670 printer models
    • depending on the mood of the printer, it will not print anything at all

The Issues

  • some printers occasionally just don't print anymore and pile up jobs (check lpstat)
    • though this also happens with "legit" reasons, e.g. no paper or printer error
  • printers sometimes "dissapear" from the network and are no longer visible through e.g. lpstat -v
  • so far no reliable way has been found to resolve the issues automatically

New Approaches

  • printer-maintenance.sh
    • uses a static list of all printers (so no printer is "forgotten" if it dissapears from the network)
    • checks if a printer has any unfinished jobs and deletes them (lprm [PRINTER] -)
    • sends a new job
    • waits 1 min, then checks for unfinished jobs again
      • if there are some, this will be logged
      • those printers then need manual maintenance (or just more paper)
      • sending of notifications could be added (e.g. mail, telegram or line webhook)
    • if it works well, will merge with printerPurge.sh

Useful Commands

  • lp
  • lpstat
    • -e
    • -v
  • lprm [PRINTER] -