[opensuse] Default Printer Based On Network
I have googled this and found many answers for how to script this in Wintendo, but not so much that's clear on how do do this in Linux (or openSUSE). I am writing this on my laptop - openSUSE 10.3/32-bit KDE 3.5 - system. I use it for work both at work in my office and at my home office. At work, I print usually to an HP LaserJet 1310 I have in my office. I also occasionaly print to a workgroup printer such as one of our color laserjets or a high speed b&w printer. At home, I print to my wife's OfficeJet, connected via Samba to her Win2K computer. I want to have the system auto-switch my default printer in KDE/CUPS based on teh IP Address of where the compuer is. Though I use DHCP at work, my first two octets are always the same - 1.2.x.x - and I have a fixed IP at home - 192.168.0.102. In googling, I see that there is a commandline to set the default printer - lpadmin -d printername - which I suppose could be added to an initrc bash file. -- kai www.filesite.org || www.perfectreign.com Clean out a corner of your mind and creativity will instantly fill it. - Dee Hock -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2008-10-23 at 14:03 -0700, Kai Ponte wrote:
I want to have the system auto-switch my default printer in KDE/CUPS based on teh IP Address of where the compuer is. Though I use DHCP at work, my first two octets are always the same - 1.2.x.x - and I have a fixed IP at home - 192.168.0.102.
I think there _may_ be a provision for custom scripts when the network goes up. There is such a thing for modem connections, in /etc/ppp/ip-up.local... It could be interesting to find out if there is an equivalent for eth. let me see... look: /etc/sysconfig/network/if-up.d/ /etc/sysconfig/network/if-down.d/ Those dir contains scripts, actually symlinks to scripts in /etc/sysconfig/network/scripts. You could add a script. It seems the script gets certain parameters as arguments in the call, looking at "50-ntp", and perhaps functions prepared for doing things.
In googling, I see that there is a commandline to set the default printer - lpadmin -d printername - which I suppose could be added to an initrc bash file.
Add it to a new script like those above. Keep us posted on what you come up with finally, I'd lke to learn about this. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkA97IACgkQtTMYHG2NR9XafQCgl9F7A4yf+9m+9VT3WwT0W7dD KcQAn3ABU36JhvRzuCJ+GhURkImGuiLT =2szV -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Kai Ponte wrote:
I have googled this and found many answers for how to script this in Wintendo, but not so much that's clear on how do do this in Linux (or openSUSE).
I am writing this on my laptop - openSUSE 10.3/32-bit KDE 3.5 - system. I use it for work both at work in my office and at my home office.
At work, I print usually to an HP LaserJet 1310 I have in my office. I also occasionaly print to a workgroup printer such as one of our color laserjets or a high speed b&w printer.
At home, I print to my wife's OfficeJet, connected via Samba to her Win2K computer.
I want to have the system auto-switch my default printer in KDE/CUPS based on teh IP Address of where the compuer is. Though I use DHCP at work, my first two octets are always the same - 1.2.x.x - and I have a fixed IP at home - 192.168.0.102.
In googling, I see that there is a commandline to set the default printer - lpadmin -d printername - which I suppose could be added to an initrc bash file.
Kai, I don't know how it does it, but 11.0 on my laptop does this by itself. At home, I have a HPLJ4 connected to a 10.3 server set up in cups. At work I have a HPLJ4200 connected to (of all things) the secretary's WinXP box and a HPLJ4100N hanging off the network, both configured with cups. When I'm at the office with my laptop, the 4200 comes up as the default printer. When I'm at home, the laserjet 4 comes up as the default. The laptop I'm using just has a stock 11.0 install on it. Sorry I can't give you hints, but for some reason teh standard 11.0 install is doing this. -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2008-10-24 at 01:03 -0500, David C. Rankin wrote:
Kai,
I don't know how it does it, but 11.0 on my laptop does this by itself. At home, I have a HPLJ4 connected to a 10.3 server set up in cups. At work I have a HPLJ4200 connected to (of all things) the secretary's WinXP box and a HPLJ4100N hanging off the network, both configured with cups. When I'm at the office with my laptop, the 4200 comes up as the default printer. When I'm at home, the laserjet 4 comes up as the default. The laptop I'm using just has a stock 11.0 install on it. Sorry I can't give you hints, but for some reason teh standard 11.0 install is doing this.
auto-cups, perhaps. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkBoiAACgkQtTMYHG2NR9WUpQCggAdSmLIVT9khM1gHv18TlDRl 9UgAn0wNS8ozLxleJgcvo/0wGCt98YOS =P+vz -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Oct 23 14:03 Kai Ponte wrote (shortened):
laptop - openSUSE 10.3/32-bit KDE 3.5 - system. I use it for work both at work in my office and at my home office.
At work, I print usually to an HP LaserJet 1310 I have in my office. ... At home, I print to my wife's OfficeJet, connected via Samba to her Win2K computer.
I want to have the system auto-switch my default printer in KDE/CUPS based on teh IP Address of where the compuer is. Though I use DHCP at work, my first two octets are always the same - 1.2.x.x - and I have a fixed IP at home - 192.168.0.102.
In googling, I see that there is a commandline to set the default printer - lpadmin -d printername - which I suppose could be added to an initrc bash file.
lpadmin is for root to set the system-wide default printer in /etc/cups/printers.conf Perhaps it is easier to use lpoptions which is for normal users so that each individual user can set his preferences which are stored in ~/.cups/lpoptions since CUPS 1.2 / openSUSE 10.2 (it was ~/.lpoptions in CUPS 1.1). See http://en.opensuse.org/SDB:CUPS_in_a_Nutshell Additionally whatever application program or desktop environment could store its own idea of what the default queue is somewhere (e.g. another default than what CUPS would use or use the last-used queue by default or anything else). Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Carlos E. R.
-
David C. Rankin
-
Johannes Meixner
-
Kai Ponte