Thursday, 30 May 2013

How to install a network printer at CERN under Ubuntu

Installing a driver at CERN is kind of a puzzle, unless you run Windows or SLC. Unfortunately there are no tutorials how to do that. This is why I came up with the following, somewhat hackerish, solution:
  1. Install packages libnet-ldap-perl and cups on your system using apt-get
  2. Download the lpadmincern RPM package.
  3. Unpack it.
  4. Replace inside lpadmincern.pl
    my $cupsc='/sbin/service cups reload';
    with
    my $cupsc='/usr/sbin/service cups reload';
  5. Replace
  6. $command="LC_ALL=C /usr/sbin/lpadmin -p $prt->{printerName} -L \"$prt->{location}\" -D \"$prt->{description}\" -v $uri $duplex $media -o printer-is-shared=false -E";
    with
    $command="LC_ALL=C /usr/sbin/lpadmin -p $prt->{printerName} -L \"$prt->{location}\" -P $prt->{ppdfile} -D \"$prt->{description}\" -v $uri $duplex $media -o printer-is-shared=false -E";
    Apparently this got replaced in the meanwhile.
  7. install libnet-ldap-perl
  8. Find your desired printer at CERN printing service
  9. Move the whole directory to /usr/share/lpadmincern, otherwise it would complain about a missing directory.
  10. Run
    perl lpadmincern.pl --add [your-printer-name-here]

How to check number of cores per CPU

echo $(($((`cat /proc/cpuinfo | grep 'processor' | sort -n | wc -l`))/$((`cat /proc/cpuinfo | grep "physical id" | sort -n | uniq | wc -l`))))