NAS

Switching power outlets with CUPS/sispmctl

14 2955
tkaiser  
Edited by tkaiser at Wed Nov 26, 2014 05:37

The following is an approach to switch the sockets of USB-connected cheap EnerGenie EG-PM2, EG-PMS, EG-PMS2 socket outlets via CUPS and sispmctl:



The idea behind: Use your ARM board as print server and easily switch on laserprinters when they're needed and switch them off after printing by sending any print job to a special queue that switches the printer's power socket off (don't do that with inkjets or any other device that needs to be turned off safely!)

Here you can find the backend that does the job: http://pastebin.com/S8n7jN2S (read/understand the comments in the script's header carefully. The installation details are outlined there)

Prerequisits (replace "apt-get install" with "yum install" or "pacman -S" when your distro is not Debian based):
  1. apt-get install cups sispmctl
  2. chmod u+s /usr/bin/sispmctl
  3. cupsctl --remote-admin
Copy the Code
Afterwards you can access the CUPS webinterface using https://$IP-ADDRESS-OF-YOUR-BANANA:631/admin/ (you might want to disable remote access afterwards via the web interface itself or by 'cupsctl --no-remote-admin' as root). If there are SiS-PM power outlets connected they will be listed when you access "Add Printer". In my case 2 devices are connected with different serial numbers (01:01:51:45:0b and 01:01:51:23:cb).

Imagine there is a LaserJet HP4500 connected to the fourth socket of the first power outlet then we would need two pseudo printers to switch the printer on and off:







Don't choose a PPD but use 'raw' as printer type, assign any name you want and take care that you enable the 'Share This Printer' checkbox when you want to use this 'pseudo printer' from other machines (this is the real purpose of this whole setup since otherwise you could use sispmctl locally). To create a 'switch the device off' pseudo printer you just choose the right 'device' and then it's exactly the same procedure:



The printer queue names and descriptions do not matter at all since socket and serial number are encoded in the queue's so called 'Device URI' starting with sispmctlcups:// in our case:
  1. root@bananas ~ # lpstat -t
  2. scheduler is running
  3. no system default destination
  4. device for power_off_laserprinter: sispmctlcups://01_01_51_45_0b-4-off
  5. device for switch_on_laserjet: sispmctlcups://01_01_51_45_0b-4-on
  6. device for Switch_Socket_4_on_second_SiS-PM_on: sispmctlcups://01_01_51_23_cb-4-on
  7. ...
Copy the Code


You could not only switch printers on and off using CUPS but other connected devices as well (sounds weird in the first place but the good news is that CUPS supports fine grained authentication for different queues so you can just allow specific machines/users in your network to switch devices connected to the print server). And using eg. Tea4CUPS you could create CUPS queues that consist of two queues: The one that accesses the printer and prints the job and another sispmctl queue that leads automagically to a powered on printer if it was switched off before (you can also use 'prehooks' with Tea4CUPS that switch the printer on prior to printing and then use just a 'switch the printer off when finished' queue to power-off manually over the network).
mega-hz  
Hello,

i made a PI-Printserver using cups and tea4cups and need some help:

tea4cups should turn on a relays before printing to the Laser and turn off the relays after printing with prehook and posthook.
I made two little scripts to switch an gpio and they are working fine.
But i canT get it running with tea4cups.
Maybe i made an error so please help me?

Tis is my printers.conf:


# Printer configuration file for CUPS v1.7.5
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<Printer Canon_iP7200_series>
UUID urn:uuid:821b37ce-6a4f-3c31-6099-a3aec50e5cd7
Info Canon iP7200 series
Location print-server
DeviceURI tea4cups:usb://Canon/iP7200%20series?serial=088A3E
State Idle
StateTime 1501951645
Type 36892
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>
<Printer FS-1020D>
UUID urn:uuid:3a66e55b-0c8d-3ac9-7a46-da5672b9dac8
Info Kyocera FS-1020D
Location print-server
DeviceURI tea4cups:usb://Kyocera/FS-1020D?serial=XAX5777229
State Stopped
StateMessage Unplugged or turned off
StateTime 1502138997
Reason paused
Type 4116
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>



And this is my tea4cups.conf:


[FS-1020D]
prehook : /home/pi/relays_on.py
posthook : /home/pi/relays_off.py

What is wrong?

Thank you very much for help!

mega-hz  
This works:

[global]
prehook : /home/pi/relays_on.py
posthook : /home/pi/relays_off.py

why not on [FS-1020D] ?

coach outlet online
uggs
ray bans
michael kors uk
canada goose jackets
michael kors outlet online
canada goose jackets
ralph lauren sale
canada goose coats
louis vuitton factory outlet
uggs outlet
burberry outlet online
coach factory outlet online
moncler
yeezy boost
yeezy shoes
moncler coats
louis vuitton outlet store
moncler jackets
fred perry shirts
ugg boots
michael kors outlet canada
jerseys cheap
cheap air jordans
ugg outlet online
cheap ugg boots
michael kors outlet online
ugg boots
polo outlet online
pandora charms sale clearance
birkenstock shoes
longchamp bags
uggs on sale
michael kors outlet store
ray ban sunglasses discount
harden vol 1
adidas yeezy boost
birkenstock outlet
ugg boots
ugg boots
coach outlet store
moncler outlet online
salvatore ferragamo outlet
moncler uk
michael kors
red bottoms
adidas outlet online
ugg boots
uggs outlet
uggs outlet
mbt
ferragamo shoes
ralph lauren outlet online
cheap air jordans
pandora charms outlet
polo ralph lauren outlet
cheap jordan shoes
ugg outlet
adidas outlet online
salvatore ferragamo shoes
coach outlet online
coach outlet store
ugg boots
columbia sportswear outlet
mlb jerseys cheap
supreme shirts
ugg outlet
ugg australia outlet
ugg outlet
canada goose jackets
coach outlet online
ugg outlet online
pandora charms
coach outlet online
coach factory outlet online
canada goose outlet online
canada goose jackets
north face jackets
louboutin outlet
mulberry
ugg canada
canada goose jackets
coach handbags outlet
uggs outlet
adidas nmd r1
michael kors outlet store
nike outlet
michael kors handbags
ugg outlet
uggs outlet
ugg boots
canada goose parka
coach outlet online
pandora uk
canada goose outlet
louboutin outlet
fitflop sandals
birkin handbags
the north face outlet
air jordan retro
air max
michael kors outlet clearance
michael kors outlet online
moncler jacket
ugg boots outlet
canada goose outlet
ugg canada
canada goose
uggs outlet
adidas nmd runner
michael kors outlet online
north face jackets
uggs sale
coach factory outlet online
canada goose sale
cheap air jordans
michael kors outlet store
air max shoes
adidas superstar shoes
171128yueqin

20186.14chenjinbei
flops
cheap jordan shoes
air max 270
kate spade
mont blanc
fitflops
jordans
mishka clothing
jimmy choo shoes
camisetas de futbol replicas
timberland boots
adidas football boots
coach outlet online
supra shoes
malone souliers mules
fussball trikots
supreme
ralph lauren
ferragamo shoes
burberry canada
christian louboutin
asics running shoes
nfl jerseys wholesale
air max 97
red bottoms
fitflop sandals
ralph lauren
puma slides
manchester united jersey
air max 90
true religion jeans
camisetas de futbol baratas
beats by dre
coach outlet online
nike epic react
y-3 shoes
links of london
ralph lauren
nike air max
kate spade handbags
oakley sunglasses
jordan 3
cheap jerseys
nike flip-flops
air jordan 14
light up shoes
nike dunks
new balance
converse shoes
cheap nfl jerseys
adidas yeezy 350
nike blazer
ray ban sunglasses
nike lunarglide
air max
ferragamo outlet
air jordan 11
nike shox
michael kors handbags
adidas jeremy scott
jordans
coach factory outlet
ralph lauren uk
ray ban outlet
jordan 4
air max 95
balance shoes
coach handbags
ralph lauren
miu miu shoes
air max
coach outlet store
michael kors outlet
breitling watches
nike air force
ralph lauren
carnival shoes
vans shoes
adidas slides
christian louboutin shoes
nike tn
balenciaga shoes
kobe 12
running shoes
burberry outlet
air max 2017
air max 1
harden vol 1
air force 1
roshe run
cheap mlb jerseys
adidas nmd
juicy couture outlet
superdry clothing
ferragamo
nike shoes
wholesale nfl jerseys
huarache
michael kors outlet clearance
jordan
cartier jewelry
christian louboutin outlet
air max plus
mac cosmetics
prada handbags
coach outlet store online
cheap nfl jerseys
under armour outlet
dior handbags
belstaff jackets
marc jacobs
pandora charms
michael kors
michael kors outlet online
nike blazer
polo ralph
jordan 5
hermes outlet
coach factory outlet
celine outlet
coach outlet
hermes birkin bag
converse shoes
mulberry handbags
jordan xx9
nike sb
off-white clothing
cheap soccer jerseys
swarovski
tory burch outlet
longchamp
converse uk
nike revolution
nike uk
maillot de foot pas cher
flip-flops
polo outlet
nike shoes for men
ralph lauren
polo outlet
michael kors taschen
tag heuer watches
michael kors outlet store
soccer shirts
air max 2018
air jordan
adidas outlet store
basketball shoes
montblanc fountain pens
barcelona jersey
jordan 8
coach
michael kors handbags
ray ban sunglasses
pandora jewelry canada
coach factory outlet
true religion jeans
prada bags
timberland boots
supreme outlet
baseball jersey
bvlgari rings
adidas stan smith
kate spade outlet online
suicoke sandals
cheap ray bans
oakley sunglasses
mont blanc pens
kate spade
oakley sunglasses
fitflops outlet
cheap nhl jerseys
adidas shoes
adidas flip flops
off-white clothing
coach handbags
coach factory outlet online
kobe 11
nike cortez
nike outlet store
coach factory outlet online
hermes kelly bag
mbt shoes
jordan 6
cheap soccer jerseys
beats by dre
cheap nfl jerseys
longchamp outlet
pandora outlet
vibram five fingers
hermes
air max
nike kyrie 3
supreme uk
adidas yeezy
jordan
nike free run
louboutin
lebron 15
pandora jewelry
coach outlet online
polo ralph lauren
adidas superstar
maglie calcio
snapbacks wholesale
red bottom shoes
prada handbags
hollister outlet
true religion jeans
soccer jersey
cheap mlb jerseys
longchamp outlet
valentino shoes
manolo blahnik shoes
pandora charms
nike roshe
nike factory outlet
balenciaga shoes
ralph lauren uk
giuseppe zanotti shoes
air max
timberland boots
air jordan
burberry outlet online
michael kors handbags
michael kors handbags
jordan pas cher
nike outlet online
alexander mcqueen shoes
nfl jerseys
tory burch bags
scarpe mbt
oakley vault
van cleef & arpels jewelry
air huarache
coach outlet online
yeezy 500 blush
vans shoes
christian louboutin
longchamp handbags
cheap nba jerseys
harden vol 2
bcbg
mlb jerseys
asics
"nfl jerseys
"
yeezy shoes
stuart weitzman shoes
michael kors uk
timberland outlet
ralph lauren outlet
jordan shoes
longchamp
nike free run
hermes uk
ralph lauren outlet
michael kors canada
new balance sandals
michael kors outlet
givenchy handbags
adidas outlet
ralph lauren
jordan 12
undefeated shoes
nike presto
fingerlings monkey
jordan 1
oakley sunglasses
nhl jerseys
air jordan
flip-flops
breguet watches
pandora uk
wedding shoes
fila sneakers
oakley sunglasses
oakley sunglasses wholesale
true religion jeans
nike mercurial vapor
michael kors outlet store
prada outlet online
[bcheap nfl jerseys
ray ban
coach outlet
burberry outlet store
adidas stan smith
michael kors outlet
jordan shoes
dansko shoes
mcm bags
birkenstock
ray ban sunglasses
maglie calcio a poco prezzo
cheap replica watches
ray ban sunglasses
polo outlet
tory burch outlet
pandora jewelry canada
ray ban
stussy hoodie
oakley canada
baseball bats
adidas wings
true religion jeans
columbia sportswear
michael kors outlet
nfl jerseys
prada
ray ban sunglasses cheap
nike shoes
true religion
coach outlet
kate spade
longchamp handbags
pandora jewelry
nike free
kate spade outlet
fitflop sandals
fitflops sale clearance
nike outlet
nike free
kevin durant shoes
jordans
adidas nmd
louboutin
longchamp
adidas uk
birkenstock sandals
gucci slides
coach factory outlet
mizuno running shoes
michael kors handbags
ralph lauren
ralph lauren uk
adidas ultra boost
ralph lauren polo shirts
louboutin
rolex watches
louboutin outlet
michael kors outlet
puma fenty sandals
louboutin
coach outlet online
audemars piguet
tory burch uk
nike uk
bottega veneta
nike outlet
air jordan
michael kors outlet
tod's shoes
nike outlet store online
dolce and gabbana
herve leger dresses
christian louboutin outlet
cheap oakley sunglasses
Fußballtrikots günstig
birkenstock outlet online
jordan shoes
adidas outlet store
maillot de foot
coach outlet online
cheap ray ban sunglasses
coach outlet online
timberland outlet
coach
coach outlet
coach factory online
kate spade
curry shoes
air jordan
supreme paris
swarovski jewelry
tory burch
jordan retro
nike tennis
nike outlet
ray ban
balenciaga sandals
20186.14chenjinbei

20188.15wengdongdong
ralph lauren
air max 2018
nike sb
christian louboutin outlet
coach outlet
supreme uk
lebron james jersey
north face outlet
alexander mcqueen shoes
tiffany jewelry
coach outlet
michael kors outlet
philipp plein outlet
true religion
air max
wholesale hats
coach outlet online
balenciaga sandals
adidas originals
converse
ferragamo outlet
michael kors outlet online
polo ralph lauren
hermes belt
air jordan
cheap mlb jerseys
versace clothing
michael kors taschen
prada
oakley sunglasses wholesale
ray ban sunglasses
air max 270
christian louboutin shoes
hermes bags
under armour shoes
nike free run
ralph lauren
timberland
jordan
michael kors handbags
adidas outlet
flip-flops
michael kors outlet
longchamp
michael kors outlet clearance
fitflops sale clearance
cartier jewelry
coach factory outlet
ysl handbags
converse shoes
cheap nhl jerseys
ray ban sunglasses
ray ban outlet
coach outlet online
nike shoes
michael kors outlet clearance
ugg outlet
true religion jeans
oakley vault
oakley sunglasses
cheap mlb jerseys
pandora charms
michael kors bags
nike outlet store online
replica watches
prada outlet online
michael kors outlet
baseball jersey
puma outlet
mont blanc pens
giuseppe zanotti shoes
nike blazer
moose knuckles jackets
running shoes
michael kors canada
y-3 shoes
mcm bags
philipp plein outlet
pandora charms
nike factory
nike factory
nike lunarglide
vans shoes
baseball bats
maillot de foot
links of london
spalding basketball
nike outlet
cheap nfl jerseys
air max 95
vendita maglie calcio
fußballtrikots ermäßigung
puma slides
nike blazer
soccer shirts
christian louboutin
supreme clothing
adidas jeremy scott
20188.15wengdongdong

2018.9.10zhouyanhua
giuseppe zanotti
instyler
michael kors handbags
nike store
ghd hair straighteners
dior sunglasses
bcbg max
mulberry handbags
iphone x case
michael kors handbags
portugal world cup jersey
abercrombie and fitch
jordan 1
curry 2
toms shoes
hermes jewelry
jordan 5
curry 4
new balance 574
coach outlet
tory burch outlet
christian louboutin shoes
polo ralph lauren
clarisonic mia 2
michael kors handbags
air jordan
air max 90
ugg outlet
parajumpers outlet
marc jacobs handbags
nike tn
gioielli swarovski
nike free 5
clarks shoes
jimmy choo sunglasses
nike blazer
bottega veneta handbags
hollister
kenzo clothing
fitflop uk
ghd hair straighteners
chrome hearts jewelry
nike air force
jordan 11
france world cup jersey
montre pas cher
polo ralph lauren
celine handbags
miu miu shoes
kyrie irving jersey
givenchy handbags
air max 97
red bottoms
longchamp bags
england world cup jersey
chrome hearts
burberry sale
kevin durant jersey
nike mercurial
adidas soccer cleats
ralph lauren
pandora jewelry
adidas outlet
designer sunglasses
montre femme
coach outlet
nike air max
bulgari jewelry
ghd hair straighteners
brazil world cup jersey
chloe handbags
adidas outlet
ray ban sunglasses
polo lacoste
coach outlet store online
ferragamo belts
puma shoes
sac longchamp
nike kyrie 2
versace sunglasses
tommy hilfiger
salvatore ferragamo
bally shoes
bose headphones
oakley sunglasses
longchamp outlet
tod's shoes
bcbg outlet
cheap nfl jerseys
dolce & gabbana
skechers sneakers
true religion outlet
oakley sunglasses
coach purse
jbl speaker
nike air max
nike free run
adidas trainers
kd shoes
longchamp handbags
2018.9.10zhouyanhua

You have to log in before you can reply Login | Sign Up

Points Rules