Do you have an inkjet tank printer, such as an Epson EcoTank? Do you not print often enough, thus your printheads get clogged, and you reduce the lifetime of your printer by filling up the waste sponge with each head cleaning?
Here, take clogtank.sh, a Bash script which generates a simple image with many colors and prints it with the given printer. Just add it to a cronjob, remember to keep paper loaded to your printer, and never have a clogged printhead again! (Hopefully!)
🔔 Update on August 10th 2025: I changed the script to only generate all of the CMYK colors, because even after printing the patterns every 3 days, my personal EcoTank kept clogging... (a printer producer wouldn't programmatically make their printer produce white stripes, would they...?)
- Bash on Linux (might work on WSL too?)
- Tested to work on
Debian 6.1.106-3
- Tested to work on
- CUPS (
sudo apt install cups cups-client) and a printer configured on it - ImageMagick (
sudo apt install imagemagick)- Tested to work with version
ImageMagick 6.9.11-60 Q16 x86_64
- Tested to work with version
If you want to automate the printing, you will need a Linux server, NAS, Raspberry Pi, or anything connected to your printer (or network, if you want to get fancy). Then you will also need Cron.
./clogtank.sh cups_printer_id_hereTested on a network EcoTank with the following command:
./clogtank.sh EPSON_ET_2870_SeriesIf for some reason your CUPS will not print the jpeg directly, you can give "pdf" as the second argument:
./clogtank.sh cups_printer_id_here pdfTo use this, you will probably have to allow PDF modifications in ImageMagick's security policy.
Run crontab -e to edit your Cron jobs.
Then add the following line:
0 15 */3 * * /path/to/clogtank.sh cups_printer_id_here
This will print a random page every 3 days at 15:00.
ImageMagick and Cups might work differently based on the installed version. Go ahead and modify the script parameters for your need, if it doesn't work at first!
On my server, the jpeg does not get printed. The printer just wakes up and does nothing. Thus, there is the option to print the image as a pdf.
Just provide pdf as the second parameter to the script (i.e. ./clogtank.sh printer_id pdf).
Below is an example of the produced image. The script generates color patterns and masks it with some pixelated noise.
Then it sends the image to your chosen printer via lp,
and requests the image to be fit to the page.
The idea is that by printing all colors often enough, the printheads shouldn't get clogged.
Does this waste a lot of ink? Honestly, I'm not concerned of that. After printing hundreds and hundreds of pages on an ink tank printer, and only seeing the ink levels drop a little, it shouldn't be an issue.
And afterall, less head cleanings means less money spent on a maintenance box or a new printer in the future, even if a few A4 sheets were wasted in the process.
The script is licensed under the MIT license. This project was made just for fun (and for a very specific use of the author), but useful commits are welcome!