Sunday, May 24, 2009

Tips: solution for [warning: dict_nis_init: NIS domain name not set - NIS lookups disabled]

error messages in maillog:


May 24 23:24:03 TXB-FW postfix/smtpd[31444]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 24 23:24:03 TXB-FW postfix/smtpd[31444]: warning: SASL: Connect to private/auth failed: Connection refused
May 24 23:24:03 TXB-FW postfix/smtpd[31444]: fatal: no SASL authentication mechanisms

First of I didn't ask postfix to do NIS lookups.

The fix was simple.

alias_maps when commented, uses the default settings:
alias_maps = hash:/etc/aliases, nis:mail.aliases

This allows postfix to work even without explicit alias_maps settings. However the default also encumbers it with checking nis. Setting alias_maps explicitly eliminates the problem:
alias_maps = hash:/etc/aliases


http://blog.taragana.com/index.php/archive/how-to-fix-postfix-warning-dict_nis_init-nis-domain-name-not-set-nis-lookups-disabled/

Friday, May 22, 2009

free command information explanation

# free

total used free shared buffers cached
Mem: 1021452 90948 930504 0 5320 61128
-/+ buffers/cache: 24500 996952
Swap: 2104472 0 2104472


total - size of the total memory 1021452Bytes
used - memory that has been used 90948Bytes
free - memory that hasn't been used 930504Bytes
shared - abandoned currently is always 0
buffers - buffer memory 5320Bytes
cache - cache memory 61128Bytes

The relationship:

total = used + free

(- /buffers/cache) used memory: used memory=used-buffers-cached
(+/buffers/cache) free memory: free memory=free + buffers + cached

-/buffers/cache
reflects the size of memory that the programe really have used , and +/buffers/cache reflect the total size of memory that can be misappropriated.

Wednesday, May 13, 2009

Suse 9: Network configuration

Network configuration on Suse has substantially evolved since version 8.0 and resembles the one found in various other Linux distributions.
As usual Yast2 can be used to fully configure network devices nad TCP/IP settings and since we presume you already know how to do it with a graphical interface, let's see, more deeply the involved files.

Configuration files
/etc/sysconfig/network/ifcfg-*
These are the systems's configuration files for every network interface where "*" can be the name of the inteface (eth0, eth1, lo, ppp0...), its MAC address (ex: 00c09f2dc8a4) or indicate what hardware is used (usb, pcmcia).
The main parameters used in these files are:
BOOTPROTO - Can be static (IP configured manually), dhcp (IP oubtained through DHCP)
IPADDR BROADCAST NETMASK NETWORK - Define typical IP parameters: IP address, broadcast, netmask and network address
MTU - Defines the Maximum Transfer Unit (the size of every IP packet). Default on ethernet devices is 1500.
STARTMODE - Indicates the to activate the interface: onboot (at system's boot), hotplug (when a pluggable network device is inserted), manual (manually).
Other parameters can be used and can vary according to the interface type.

/etc/sysconfig/network/config
Contains various, well commented, variables that are applied to every interface, they include also what actions can be done when the interface status is changed. The same values can be specified in the single /etc/sysconfig/network/ifcfg-* files, for a more granular control on the single interfaces.
/etc/sysconfig/network/dhcp, similarly, sets parameters related to dhcp use (logging, lease time, timouts, modification of system's settings, wait time at boot and so on).
/etc/sysconfig/network/wireless sets and describes the various parameters that can be applied to wireless devices (wieless mode, essid, frequency, sensibility, encryption key...). As usual they can be used in the ifcfg files of the single wireless devices, but it's useful to know the options than can be used.

/etc/sysconfig/network/routes
Defines all the (general) static routes. It's possible to specify routes exclusively related to the activation of single interfaces with the files /etc/sysconfig/network/ifroute-interface.
The format of this file is:
DESTINATION GATEWAY NETMASK|PREFIX INTERFACE [TYPE] [OPTIONS]


/etc/resolv.conf
Defines, as in most Unixes, the address of the DNS server to be used by the system.
Some services (pppd, ipppd, dhcpclient, hotplug, pcmcia, pptpclient) can temporarily modify this file in order to use, according to the new connection established, the appropriate DNS server. This is done by Suse's nice shell script /sbin/modify_resolvconf which has various options to handle and manage different dynamic entries in /etc/resolv.conf and /etc/named.conf.

/etc/hosts
As in most Unixes, in this file you can statically assign IP addresses to host names. You can also use /etc/networks for IP networks. The resolver by default first checks this file, before querying the DNS servers in /etc/resolv.conf. This order and other settings about how the system assigns names to resources can be changed (as in every Linux) in /etc/host.conf (old configuration file used by libc4 and libc5 linked programs) or /etc/nsswitch.conf (used by every recent program linked with glibc libraries).

/etc/HOSTNAME
Contains the hostname of the system, used by various startup scripts.

Commands
SuSE features typical Linux network related commands as ifconfig route netstat ip and other commands which can be found in various distros such as ifup (can be invoked also by the symlinks ifstatus or ifdown giving status info on the specified interface or shutting it down) .
Similarly to RedHat's service command, SuSE provides a set of scripts, or better symlinks, to manage to init scripts for the various services:
/sbin/rcnetwork restart restarts the network services as would do the command /etc/init.d/network restart.

SourceForge Tools

FormEntry can generate an HTML form directly from a table, providing an easily created and maintained form which is tightly tied to your database table.

GPlot is a simple front-end to GNU plot. It makes generating plots from one or more files of data just a simple command.

Pipemore is intended to be used as the last of a series of piped commands. It captures the data on the pipe (STDOUT) and displays it in a scrolled text window where you may search or save it. Think of it as a 'more' window you can leave open and reference later.

Simple Website Software is my attempt to provide software to generate a reasonably modern looking web site while requiring a minimal amount of effort to set up and yet keep the HTML pages independent so they can be easily modified outside the web site. This web site uses SWS.

SQLDiff tries to help answer the question 'What Changed' in a database table.

SQLView provides a user friendly interface for browsing a SQL database and modifying SQL tables using a web browser.

backmeup.pl is a script to help manage disk-to-disk backups of my data.

dosql.pl is a script to invoke MySQL using passwords in a series of config files.

dosqlclone.pl is a script to clone a MySQL table to another database or just make a copy of it. This uses the same configuration files as dosql.pl.

Genostore is aimed at small and medium sized genotyping projects. It provides a place for you to save your genotypes as well as providing a means to extract the data for analysis. Once the analysis is done, it'll help organize all those results and provide a way for you to find them again later.

getcomics.pl sends me my daily dose of comics.

jump2nr.pl is yet another way to automate upgrading Linux systems.

loginfailure.pl is a script to close the IP door on people I do not want in.

lvmmgr.sh is a script to help manage all things related to LVMs. This is especially useful if your system has LOTS of drives.

perlwh.pl is 'wh' for Perl Modules.

reminder.pl sends me reminders when important dates like birthdays and anniversaries are coming up.

important.pl is a script to create a map of drives on systems which have LOTS of drives.


SIFTER assists in managing the massive amounts of data that are generated by groups doing genetic analysis. Results are saved in a database and may be searched looking for "interesting" results which can be conveniently displayed. Unfortunately, by the time this was completed, the intended 'customer' no longer needed it, so it's in mothballs. If you think you might be interested, drop me a line.

Simple Maildata Forwarder is used to send Email from forms.

WebFile - Simple Actions for Simple Files is a rule-based tool for maniuplating files from a browser.

wh.pl is a smarter 'which'.

PuTTY for Symbian OS

http://s2putty.sourceforge.net/download.html

PuTTY for Symbian OS - Installing on S60 3rd ed.

Getting error messages about certificate errors when installing PuTTY? Read on!

PuTTY for S60 third edition is currently a self-signed application. This means that while it works without issues once installed, the application installer can either display warnings or refuse to run completely. Since installing self-signed applications can be risky, you should always check the PGP signature to ensure you are installing a real PuTTY package. However, some phones may require additional work to get PuTTY installed.

Some, or possibly all, Nokia E-series phones refuse to install self-signed applications by default. This can be fixed by changing installer settings as follows. From the device menu, open:

Tools / App. mgr. / Options / Settings

Then set "Software installation" to "All". The default on most E-series phones is "Signed only". The names will be different in devices using a different language but the same setting should be present.

Warning! This will enable installing all self-signed applications, including possible malware, so be careful what you install and don't accept installation packages from an unknown source. The installer will also list the capabilities the application needs, and you should check that those make sense. For example, it's natural that PuTTY needs network access, but if a simple game requires it something may be wrong.

Tuesday, April 28, 2009

How to find files in Linux using 'find'

$ find / -name 'program.c' 2>/dev/null
$ find / -name 'program.c' 2>errors.txt
/
Start searching from the root directory (i.e / directory)
-name
Given search text is the filename rather than any other attribute of a file
'program.c'
Search text that we have entered. Always enclose the filename in single quotes.. why to do this is complex.. so simply do so.

Note : 2>/dev/null is not related to find tool as such. 2 indicates the error stream in Linux, and /dev/null is the device where anything you send simply disappears. So 2>/dev/null in this case means that while finding for the files, in case any error messages pop up simply send them to /dev/null i.e. simply discard all error messages.

Alternatively you could use 2>error.txt where after the search is completed you would have a file named error.txt in the current directory with all the error messages in it.

-

$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'
The 1st command would find files having the letters index as the beginning of the file name. The search would be started in the directory /home/david and carry on within that directory and its subdirectories only.
The 2nd command would search for the same, but the case of the filename wouldn't be considered. So all files starting with any combination of letters in upper and lower case such as INDEX or indEX or index would be returned.

-

$ find -name met*
The above command would start searching for the files that begin with the letters 'met' within the current directory and the directories that are present within the current directory. Since the directory is not specified as the the second parameter, Linux defaults to using the current directory as the one to start the search in.

-

$ find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k
The 1st command would find within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes ( < 5MB)
The 2nd command would search from the / directory for any file that is larger than 10000k (> 10MB)

-

$ find /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'

The 1st commmand searches for those files that are present in the directory /home/david and its subdirectoires which end in .c and which have been accessed in the last 10 minutes.
The 2nd command does the same but searches for those files that have been accessed in the last 10 hours.
The 3rd and the 4th commands do the same as the 1st and 2nd commands but they search for modified files rather than accessed files. Only if the contents of the files have been modified, would their names be returned in the search results.

-

$ find / -mount -name 'win*'
This command searches for files starting with the letters 'win' in their filenames. The only difference is that the mounted filesystems would not be searched for this time. This is useful when you have your Windows partitions mounted by default. And a search for 'win' might return many files on those partitions, which you may not be really interested in. This is only one use of -mount parameter.

-

$ find /mp3-collection -name 'Metallica*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metallica*"
$ find /mp3-collection -name 'Metallica*' -or -size +10000k
Boolean operators such as AND, OR and NOT make find an extremely useful tool.
The 1st command searches within the directory /mp3-collection for files that have their names beginning with 'Metallica' and whose size is greater than 10000 kilobytes (> 10 MB).
The 2nd command searches in the same directory as above case but only for files that are greater than 10MB, but they should not have 'Metallica' as the starting of their filenames.
The 3rd command searches in the same directory for files that begin with 'Metallica' in their names or all the files that are greater than 10 MB in size.

-

T
he exec option is probably the most important feature of the find tool. The exec command allows you to execute a particular command on the results of the find command. A simple demonstration of this feature is shown below. Its upto your imagination to make maximum use of this feature. Suppose you wanted to see the details of the files (read, write, execute permission, file size, owner etc..) that have been returned as a search result you could do the following

$ find / - name 'Metallica*' -exec ls -l {\}\ \;

This command would find all the files on your system that begin with the letters 'Metallica' and would then execute the 'ls -l' command on these files. So basically you would be able to see the details of the files that were returned according to your search criteria.

The words following the -exec option is the command that you want to execute i.e. ls -l in this case.
{\}\ is basically an indicator that the filenames returned by the search should be substituted here.
\; is the terminating string, and is required at the end of the command

http://www.codecoffee.com/tipsforlinux/articles/21.html