Koozali.org: home of the SME Server

Fake printer to /dev/null [SOLVED]

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Fake printer to /dev/null [SOLVED]
« on: June 22, 2011, 07:29:16 PM »
I´d like to start testing PaperCut (installed by http://www.dungog.net/wiki/Papercut ) using a fake printer.

So I think: create one pointing to /dev/null !

I do a copy of /etc/e-smith/web/functions/printers and find

        <field id="location" type="select" options="'lp0'=>'LOCAL_PRINTER_0',
            'lp1'=>'LOCAL_PRINTER_1','lp2'=>'LOCAL_PRINTER_2','remote'=>'NET_PRINTER',
            'usb/lp0'=>'FIRST_USB_PRINTER','usb/lp1'=>'SECOND_USB_PRINTER'"
            value="remote" validation="nonblank">
            <label>LOCATION</label>

and add a new option

        <field id="location" type="select" options="'lp0'=>'LOCAL_PRINTER_0',
            'lp1'=>'LOCAL_PRINTER_1','lp2'=>'LOCAL_PRINTER_2','remote'=>'NET_PRINTER',
            'usb/lp0'=>'FIRST_USB_PRINTER','usb/lp1'=>'SECOND_USB_PRINTER','nul'=>'DevNull'"
            value="remote" validation="nonblank">
            <label>LOCATION</label>

and create a new printer (named: blackhole hehehe) using DevNull as printer port.
BUT:
Code: [Select]
[root@guepardo ~]# lpr -Pblackhole /etc/motd.jm
[root@guepardo ~]# lpq -Pblackhole
Printer: blackhole@guepardo 'Buraco Negro de Impressoes'
 Queue: 1 printable job
 Server: pid 31630 active
 Unspooler: pid 31631 active
 Rank   Owner/ID               Pr/Class Job Files                 Size Time
active root@guepardo+628            A   628 /etc/motd.jm          2962 14:28:13
error  root@guepardo+317            A   317 ERROR: too many errors

Any ideas why this do not just works ? And how to make it work ?

Thanks

Jáder

EDIT: Jun 22nd 2011 - 21:12 GMT-0300

I JUST FOUND IT,  was a TYPO!!!! The line was with "nul" (just ONE L).
The correct new fragment is:
        <field id="location" type="select" options="'lp0'=>'LOCAL_PRINTER_0',
            'lp1'=>'LOCAL_PRINTER_1','lp2'=>'LOCAL_PRINTER_2','remote'=>'NET_PRINTER',
            'usb/lp0'=>'FIRST_USB_PRINTER','usb/lp1'=>'SECOND_USB_PRINTER','null'=>'DevNull'"
            value="remote" validation="nonblank">
            <label>LOCATION</label>

Now I have a fake printer! :D
And can create lot of new fake printer as needed! using SME interface.
Should I add a NFR to include this ? :D

Regards

Jáder
« Last Edit: June 23, 2011, 02:12:56 AM by jader »
...

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Fake printer to /dev/null
« Reply #1 on: June 22, 2011, 08:02:21 PM »
Moving this post to SME Server 7.x Contribs as this has nothing to do with the packages on the SME Server installation disk, please adhere to the forum standards when posting.

As a second remark, dungog paid for contribs are not supported through the forums, you should contact dungog directly for support.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: Fake printer to /dev/null
« Reply #2 on: June 22, 2011, 09:09:53 PM »
I respectfully disagree of all comments because:
1) I´m not asking for support in DUNGOG contrib for install PaperCut
2) that is not a contrib of Dungog, just an howto, freely available on web. I just put it there to create context for everyone know what I did first.
3) What I´m looking for is a way to create a FAKE printer pointing to /dev/null  ... so just anything you print on it will disapper for ever.
4) point 3 above was done with JUST standard content (just a hack to change options... also documented in post).

I´m not searching for start a flame war... just trying to understand how to change standard SME to create a fake printer.
...