Wednesday, July 31, 2013

DashBoardClient - Stop it to install Adobe Flash on Mac

Apple/Adobe Users:

This solution worked for me with the latest version of Adobe Flash and MacOS 10.5.7 (latest software updates installed). However, I am going to clarify a bit more what I did.

Step 1 - Open Terminal (You can find it under /Applications/Utilities/)

Step 2 - To turn Dashboard off:

Type this into Terminal and press enter:

defaults write com.apple.dashboard mcx-disabled -boolean YES

Step 3 - find the Dock process id:

Type this into Terminal and press enter:

ps -ef | grep 'Dock' | grep -v 'ashboard' | grep -v 'grep'

The SECOND number from the left is the process id for the Dock.

Step 4 - Kill the Dock:

Type this into terminal and press enter (replacing '<processid>' with the number you found above, second from the left):

kill -9 <processid>

Step 5 - Install Flash Player per Adobe's installer

Step 6 - To turn Dashboard on:

Type this into Terminal and press enter:

defaults write com.apple.dashboard mcx-disabled -boolean NO

Step 7 - find the Dock process id:

Type this into Terminal and press enter:

ps -ef | grep 'Dock' | grep -v 'ashboard' | grep -v 'grep'

The SECOND number from the left is the process id for the Dock.

Step 8 - Kill the Dock:

Type this into terminal and press enter (replacing '<processid>' with the number you found above, second from the left):

kill -9 <processid>

Step 9 - Press "F12" or whatever function key brings up Dashboard to assure it is functioning again now.



Tuesday, July 30, 2013

Use LPD to print to Windows shared printer from Linux

  1. Enable LPD Print Service on Windows
    • Go to Control Panel -> Add Remove Programs
    • Click Turn Windows Features On or Off
    • Expand Print and Document Services
    • Put a check in LPD Print Service
    • Click OK. Restart once you are told to
  2. Share printer on Windows
    • Right-click on the printer you want to share, click Printer Properties
    • Click the Sharing tab
    • Check Share This Printer and give it a name
    • Make sure the name has NO SPACES!
    • You can set security from the Security tab. In my situation, I just set it to let everyone print
    • Click OK to save and close

  1. Configure Linux
    • Ensure CUPS is installed
    • Visit the CUPS administration page in the browser (http://localhost:631)
    • Click Administration and then Add Printer
    • Under the Other Network Printers section, click LPD/LPR Host or Printer and click Continue
    • In Connection put: lpd://hostname_or_ip/PrinterName . In my situation it looks like lpd://192.168.79.130/LabelPrinter where 192.168.79.130 is the IP of my Windows machine, and the printer share name is LabelPrinter. Click Continue
    • Give the printer a name(remember the name), description and location. You can also share this printer from here as well. I did not do this in my situation because I will be printing directly from this Linux server to Windows. Click Continue
    • Next comes the driver portion. In my situation I used a ppd file, so if you have one of those you can pick it here. Otherwise you will have to pick a make and model of your printer. Click Add Printer.
    • You can set up some defaults for the printer here if you so desire.
  2. Test Print!
    • From linux I ran these 2 commands:
      echo “Hello” > test.txt
      lpr -P PrinterName test.txt
      (where PrinterName is the name we gave CUPS for our printer)
    • You should see a print come through that says Hello
This is a very basic configuration described here, but it should at least get you started.

Monday, July 29, 2013

Adding a network printer with lpadmin in Linux


Configuring CUPS printers can be a bit of a pain, due to differences in URIs and drivers depending on the printers make and model. Many distributions have administrative GUIs that make printer management easier, and you can usually interact with CUPS through your browser at http://localhost:631/admin, but I prefer using the command line to get a better feel for the underlying system.

CUPS has excellent documentation. I found the sections on command line and printing options and configuring network printers particularly informative. Combined with some additional browsing and trial and error, here is the procedure to add a new default network printer, in this case an HP LaserJet 4240 at 123.45.67.89 with lpadmin.

The basic template for adding and enabling a new printer is
lpadmin -p printer-name -v device-uri -m model -L location -E

For printer-name and location, just pick something that makes sense to you. device-uri will include some extra fluff around your printer's IP address. Consult the table in the CUPS docs for ideas or search the net for ideas. For my LaserJet, the URI is socket://123.45.67.89. You can list all device types that CUPS knows about with lpinfo:


$ lpinfo -v
…
network socket
…
Finally, you'll need to figure out which model (driver) to use. lpinfo leys you search through available drivers by make and model:
$ lpinfo --make-and-model 'LaserJet 4240' -m
gutenprint.5.2://hp-lj_4240/expert HP LaserJet 4240 - CUPS+Gutenprint v5.2.5
gutenprint.5.2://hp-lj_4240/simple HP LaserJet 4240 - CUPS+Gutenprint v5.2.5 Simplified
foomatic:HP-LaserJet_4240-Postscript.ppd HP LaserJet 4240 Foomatic/Postscript
drv:///hpijs.drv/hp-laserjet_4240-hpijs-pcl3.ppd HP LaserJet 4240 hpijs pcl3, 3.10.2
lsb/usr/hplip/HP/hp-laserjet_4240-ps.ppd HP LaserJet 4240 Postscript (recommended)
Choices, choices… I've heard good things about Gutenprint, so we'll use that. Not that I ask a lot of a print driver, so perhaps it would be better to use the recommended ppd file. Just pick something. If it doesn't work, you can reconfigure with a better driver later.
On my Gentoo system, the lpinfo call failed with
lpinfo: client-error-not-found
To fix this, I had to emerge net-print/gutenprint.
Putting it all together, add and enable the new printer:
# lpadmin -E -p afmlab -v socket://123.45.67.89 -m gutenprint.5.2://hp-lj_4240/expert -L "LaserJet 4240, Disque 927" -E
Note the two -E options. The first one (before -p) forces encryption when connecting to the server. The last one enables the destination and starts accepting jobs.
You'll probably also want to make the new printer the default:
# lpadmin -d afmlab
The CUPS daemon will eventually (i.e. after a few seconds) flush these configuration changes into /etc/cups/printers.conf if you prefer editing text files to the command line or GUI tools ;).
If you want to add a printer to your local CUPS server that is already configured from another CUPS server (e.g. printing from your laptop (local CUPS) to a USB printer plugged into your desktop (another CUPS)), you can just drop the model info:
# lpadmin -E -p afmlab -v http://my-desktop:631/printers/afmlab -L "LaserJet 4240, Disque 927" -E
where my-desktop should be the domain name or IP address of the remote CUPS server.

Tuesday, July 23, 2013

How Do I Cancel a Print Job in AIX?



To cancel just 1 print job, first identify the job #, by typing the following (We’ll use lp1 as an example):


lpstat -plp1
(make note of the # listed in the “Job” column; we’ll assume it’s “123″ for this example)
Type in:
cancel 123
To cancel all print jobs on lp1, type the following:
cancel lp1
To cancel print jobs from the Universe spooler, Find the job # with this command:
usa -j  or usa -p lp1
To cancel one job (i.e. job # 123),  type in
usm -k 123
To delete all jobs in the Universe spooler for lp1:
usm -k -p lp1

Tuesday, July 2, 2013

Rebooting the Magic Way


If you have ever had a hard drive fail on a remote server you may remember the feeling you had after trying to issue the following commands:
    # reboot
    bash: /sbin/reboot: Input/output error
    # shutdown -r now
    bash: /sbin/shutdown: Input/output error
Obviously, there is a problem with your drive. These commands are failing because the kernel is unable to load the /sbin/reboot and/sbin/shutdown binaries from the disk so that it can execute them.
A fsck on the next boot might be able to correct whatever is wrong with the disk, but first you need to get the system to reboot. If your machine is located at a managed hosting provider then you could submit a reboot ticket, but you'll have to wait for someone to take responsibility.
Wouldn't it be nice if there was a way to ask the kernel to reboot without needing to access the failing drive? Well, there is a way, and it is remarkably simple.
The "magic SysRq key" provides a way to send commands directly to the kernel through the /proc filesystem. It is enabled via a kernel compile time option, CONFIG_MAGIC_SYSRQ, which seems to be standard on most distributions. First you must activate the magic SysRq option:
    echo 1 > /proc/sys/kernel/sysrq
When you are ready to reboot the machine simply run the following:
    echo b > /proc/sysrq-trigger
This does not attempt to unmount or sync filesystems, so it should only be used when absolutely necessary, but if your drive is already failing then that may not be a concern.
In addition to rebooting the system the sysrq trick can be used to dump memory information to the console, sync all filesystems, remount all filesystems in read-only mode, send SIGTERM or SIGKILL to all processes except init, or power off the machine entirely, among other things.
Also, instead of echoing into /proc/sys/kernel/sysrq each time you can activate the magic SysRq key at system boot time using sysctl, where supported:
    echo "kernel.sysrq = 1" >> /etc/sysctl.conf
If you would like to learn more about magic SysRq you can read the sysrq.txt file in the kernel documentation.