tr “\\n” “,”
Category Archives: Unix
ldap_add: Invalid syntax (21) – fix
This error was driving me nuts:
additional info: objectClass: value #0 invalid per syntax
despite looking at my ldif a hundred times, until I relized my perl script added white space at the end of the line ….
print "objectClass: person \n";
print "objectClass: organizationalPerson \n";
print "objectClass: inetOrgPerson \n";
print "objectClass: mozillaOrgPerson \n";
print "objectClass: evolutionPerson \n";
print "objectClass: simpleSecurityObject \n";
once changed to :
print "objectClass: person\n";
print "objectClass: organizationalPerson\n";
print "objectClass: inetOrgPerson\n";
print "objectClass: mozillaOrgPerson\n";
print "objectClass: evolutionPerson\n";
print "objectClass: simpleSecurityObject\n";
The ldap gods were smiling again, hope this saves someone some time.
Parse a csv file using perl
While parsing and converting some CSV files to ldif’s I needed a perl script, the Test::CSV module is helpful :
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;my $file = ‘prospects.csv’;
my $csv = Text::CSV->new();
open (CSV, “< ", $file) or die $!;
while (
) {
if ($csv->parse($_)) {
my @columns = $csv->fields();
print “@columns\n”;
} else {
my $err = $csv->error_input;
print “Failed to parse line: $err”;
}
}
close CSV;
Centos5: nfs clients get premission denied
While working on ny NFS cluster project , I could not mount my nfs exports from clients ( FreBSD & Centos ).
on the FreeBSD client I got these responses :
[udp] server:/data/dir1: Permission denied
on the CentOS client I got these responses:
mount: server:/data/dir1 failed, reason given by server: Permission denied
On the Centos NFS server the logs showed :
mountd[12377]: authenticated mount request from client1:984 for /data/dir1 (/data/dir1)
Turns out there’s a bug in CentOS and modprobe does not mount the nfsd procs , you can fix the issue by adding :
none /proc/fs/nfsd nfsd auto 0 0
to /etc/fstab
or manually ( if you want to make sure that is the issue ) :
/bin/mount -t nfsd nfsd /proc/fs/nfsd
find whats causing a busy partition in freebsd
trying to umount an nfs or external disk partition and got “partition busy” ?
use fstat -f to find out what the hold up …
the named file arguments, or to the file system containing the
current directory if there are no additional filename arguments.
For example, to find all files open in the file system where the
directory /usr/src resides, type ``fstat -f /usr/src''.