After having a couple sets of ink cartridges dry up on me after extended non-use, I learned that I’d need to print something regularly to keep my cheap inkjet printer working. After ignoring a few of my own reminders to print a test page manually, I decided to create an automated solution using a cron job on a Raspberry Pi I already have running on my home network.
With the printer added, I ran
lpstat -p -d to get the exact name of the printer, then
lp -d <printer> <file> to send a file to the printer.
To add the weekly cron job, I ran
crontab -e and added the following line to get it to print weekly at noon on Sundays:
0 12 * * Sun lp -d HP_DeskJet_printer Sample.pdf