8

I called the hack "blow up bunny", was in my first company.

We had 4 industrial printers which usually got fed by PHP / IPP to generate invoices / picking lists / ...

The dilemma started with inventory - we didn't have time to prepar due to a severe influenza going round (my team of 5 was down to 2 persons, where on was stuck with trying to maintain order. Overall I guess more than 40 % ill, of roughly 70 persons...)

Inventory was the kind of ultimate death process. Since the company sold mobile accessoires and other - small - stuff.

Small is the important word here....

Over 10 000 items were usually in stock.

Everything needed to be counted if open or (if closed) at least registered.

The dev task was to generate PDFs with SKUs and prefilled information to prevent disaster.

The problem wasn't printing.

The problem was time and size.

To generate lists for > 10 000 articles, matching SKUs, segmented by number of teams isn't fun.

To print it even less. Especially since printers can and will fail - if you send nonstop, there is a high chance that the printer get's stuck since the printers command buffer get's cranky and so on.

It was my longest working day: 18 hours.

In the end "Blow up bunny" did something incredibly stupid: It was a not so trivial bash pipeline which "blew up" the large PDF in a max of 5 pages, sent it to one of the 4 printers in round robin fashion.

After a max of 4 iterations, bunny was called.

"bunny" was the fun part.

Via IPP you can of course watch the printer queue.

So...

Check if queue was empty, start next round with determined empty printer queues.

Not so easy already. But due to the amount of pages this could fail too.

This was the moment where my brain suddenly got stuck aft 4 o clock in the morning in a very dark and spookey empty company - what if the printer get's stuck? I could send an reset queue or stuff like that, but all in all - dead is dead. Paper Jam is paper jam.

So... I just added all cups servers to the curl list of bunny.

Yes. I printed on all > 50 printers on 4 beefy CUPS servers in the whole company.

It worked.

People were pretty pissed since collecting them was a pita... But it worked.

And in less than 2 hours, which I would have never believed (cannot remember the previous time or number of pages...)

Comments
Add Comment