18 December 2007

"init: Id "x" respawning too fast: disabled for 5 minutes."

In most distributions this means that the system is booting by default into runlevel 5, which is supposed to respawn (re-start again after it's been exited) a graphical login via xdm, kdm, gdm, or whatever,and the system can't locate the program.

However, "Id" can also indicate the absence or misconfiguration of another program, like mingetty, if init tries to respawn itself more than 10 times in 2 minutes.

Id "x" is the number in the leftmost column of the /etc/inittab file:

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

Commenting the offending line out and then fixing the errant program and testing on the command line will allow you to see any error messages that go to standard error output (console) if the errors are not going to the system log file. Uncomment the line and restart init with "kill -SIGHUP 1" or "telinit q" to cause init to reinitialize and reread the /etc/inittab file.

06 December 2007

HP: Intergrated Lights Out (ILO)

Server remote management is a necessity for IT organizations of all sizes today as they strive to meet business demands for efficiency and responsiveness. HP remote management(ILO) gives us virtual presence, i.e.complete control as if you were in front of servers in datacenters or remote sites. This means you are always in control regardless of server
status or location.

Note:ILO is similar to HP's GSP/MP and Sun™ Advanced Lights Out Manager (ALOM) Port.

27 November 2007

Nautilus opens a new window every time I click a folder. How can I change it back to the old behavior?

The new Nautilus uses a spatial mode, where each folder that is clicked on opens a new folder. Many people believe that this is an improvement in usability while others do not like the way that the new Nautilus works.
It is easy to revert Nautilus back to its old "Browser mode" by issuing the command below as the current user:

gconftool-2 --type bool --set /apps/nautilus/preferences/always_use_browser true 

You may have to log out, then back in again for the changes to take effect.
To change this back to its original behavior issue the command:
 
gconftool-2 --type bool --set /apps/nautilus/preferences/always_use_browser false
Nautilus can be further customized by using the "Configuration Editor" in the System Tools menu.

22 November 2007

How to setup cronjobs

cron is a utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix/Linux.

Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times.

Following points sum up the crontab functionality :

1. Crontab Restrictions
2. Crontab Commands
3. Crontab file - syntax
4. Crontab Example
5. Crontab Environment
6. Disable Email
7. Generate log file for crontab activity

1. Crontab Restrictions

* You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use
crontab if your name does not appear in the file /usr/lib/cron/cron.deny.

* If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab.
The allow/deny files consist of one user name per line.

2. Crontab Commands

export EDITOR=vi ;to specify a editor to open crontab file.

crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)

3. Crontab file

Crontab syntax :-

A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)


* in the value field above means all legal values as in braces for that column.
The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

Note: The specification of days can be made in two fields: month day and weekday. If both are specified in an entry, they are cumulative meaning both of the entries will get executed .

4. Crontab Example

A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*

Changing the parameter values as below will cause this command to run at different time schedule below :

min hour day/month month day/week Execution time

30 0 1 1,6,12 * -- 00:30 Hrs on 1st of Jan, June & Dec.


0 20 * 10 1-5 -- 8.00 PM every weekday (Mon-Fri) only in Oct.


0 0 1,10,15 * * -- midnight on 1st ,10th & 15th of month

5,10 0 10 * 1 -- At 12.05,12.10 every Monday & on 10th of every month


Note: If you inadvertently enter the crontab command with no argument(s), do not attempt to get out with Control-d. This removes all entries in your crontab file. Instead, exit with Control-c.

5. Crontab Environment

cron invokes the command from the user's HOME directory with the shell, (/usr/bin/sh).cron supplies a default environment for every shell, defining:

HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh

Users who desire to have their .profile executed must explicitly do so in the crontab entry or in a script called by the entry.

6. Disable Email

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

/>/dev/null 2>&1

7. Generate log file

To collect the cron execution execution log in a file :

30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log

Linux: Process Accounting (PA) tool


* To find out exactly what programs you use and for how long.
* Linux kernel has a built-in process accounting(PA) facility.
* It allows system administrators to collect detailed information in a log file each time a program is executed on a Linux
system.

Uses of PA

* To calculate the CPU time absorbed by users.
* Data collected from the PA facilities to monitor which programs are most accessed by users, and then optimize the system configuration for these types of programs.
Ex: Part of the data collected by the PA facilities includes the number of bytes that are input and output by the program and the CPU usage. A system that runs a high percentage of I/O-intensive applications may need to be optimized in ways that a system running a high percentage of CPU-bound applications not.

To query the login status,the last command parses the binary log file /var/log/wtmp.

A special user is created for this log file named reboot.So running last reboot prints the history of system reboot recorded to /var/log/wtmp

SETUP AND MAINTAINING PA

rpm file: psacct-6.3.2-41.1.i386.rpm

1.To turn process accounting on

$accton /var/account/pacct

Without arguments to psacct will turn PA off
2. ac reads /var/log/wtmp and prints users' connect times.

$ac -p : displays individual totals for each user
$ac -d : displays totals for each day
$ac --complain : lists ttys that do not have records

3.lastcomm examines /var/account/pacct for information on all previously entered commands.Information about the command's I/O operation times and CPU times

3.sa summarizes information in /var/account/pacct.The information is normally displayed to standard output,but with the -s option,summary information is written to:

* /var/account/savacct summarizes accounting information on previously executed commands
* /var/account/usracct summarizes accounting information by user

21 November 2007

'df' command says partition is full, while 'du' reports free space

The standard cause for this is some user process keeping a deleted file open.

When this happens, the space is not visible via 'du', since the file is no longer visible in the directory tree. However, the space is still used by the file until it is deallocated, and that can only happen once the last process which has the file open either closes its file descriptor to the file, or the process exits.

You can use the lsof program to try to find which process is keeping an open file. Usually it's some log file, or some large data base file which gets rotated out, but some older process are still keeping the log file open.

File format of /etc/fstab in Linux

fstab is a configuration file that contains information of all the partitions and storage devices in your computer.

*File system specifier: For disk-based file systems,either a device file,or a device label specification
*Mount point : Except swap partitions,this field specifies the mount point to be used when the file system is mounted
*File system type : Type of file system present on the specified device
*Mount Options : A comma-separated list of options that can be used to control mount's behaviour
*Dump frequency : If the dump backup utility is used,the number in this field will control dump's handling of the  specified file system
*File system check order: Controls the order in which the file system checker fsck checks the integrity of the file systems.

Mount options common to all filesystems are:
auto/noautoWith the auto option, the device will be mounted automatically (at bootup, or when we issue the mount -a command). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
dev/nodev
Interpret/do not interpret block special devices on the filesystem.
exec/noexec
exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
ro
Mount read-only.
rw
Mount the filesystem read-write.

sync/async
How the input and output to the filesystem should be done. sync means it's done synchronously. If you look at the example fstab, you'll notice that this is the option used with the floppy.,this means that copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.

suid/nosuid
Permit/Block the operation of suid, and sgid bits.

user/nouser
Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden. If nouser is specified, only root can mount the filesystem.

defaults
Use default settings. Equivalent to rw,suid,dev,exec,auto,nouser,async.

Linux: Useful Keystrokes in X

*Killing X : [ctrl+alt+backspace]
*Changing windows: [Alt+tab]
*Changing workspaces: [ctrl+alt+arrow key]
*Popping up the Red Hat Menu: [Alt+F1]

20 November 2007

How to configure the Virtual console login to display a pre-login message with Virtual Console Name?

Virtual console login prompts for a login name and invokes the /bin/login command to process the user login.mingetty handles all of these as well as opening the tty port and setting the needed modes.

tty is a kernel layer used by all Linux users to type commands at a prompt or at a serial port connection.

In order to differentiate the 6 virtual console login from each other to avoid confusion and quickly identify the current tty when having multiple users logging in locally,its possible to edit the pre-login message in the /etc/issue file.

Configure /etc/issue as below
Red Hat Enterprise Linux Server release 5.1 Beta (Tikanga)
Kernel \r on an \m
You are currently On Virtual Console \l

mingetty supports the below escape sequences to display various information:
  • \d - current day (localtime)
  • \l - current tty
  • \m - machine architecture (uname -m)
  • \n - hostname (uname -n)
  • \o - domain name (domainname)
  • \r - operating system release (uname -r)
  • \t - current time (localtime)
  • \s - operating system name
  • \u - number of users currently logged in
  • \v - operating system version (uname -v)
The tty command displays the current tty file used once the user is successfully logged in.

$tty
/dev/tty2

Output:

Red Hat Enterprise Linux Server release 5.1 Beta (Tikanga)
Kernel 2.6.18-37.el5xen on an i686
You are currently On Virtual Console tty3
client1 login:



HP-UX: Intro Guardian Service Processor(GSP) & Management Processor(MP)

All of HP's current PA-RISC and Integrity servers include a GSP/MP card which has a LAN console port.

This console port is usually called as GSP/MP port which depends on which card(GSP/MP) is installed in the physical machine.But mostly these days MP card is installed on HP-UX Servers by default.

Features:

* Enables remote server management over the web regardless of the system state.
* In the unlikely event that the operating system in not running,the GSP/MP port can be accessed to power cycle the server,view event logs and status logs,enable console re-direction,and more.
* Always-on capability: GSP/MP is alive if the power cord is plugged in.
* User/Password access control: Supports operator and administrator users
* Multiple access methods to GSP/MP:
Local port
Remote/modem port
LAN

*Mirrored console:System console output stream is reflected to all of the connected console users
*Display and/or logging of:

The system console,system event logs (chassis codes),Virtual Front Panel (VFP),and system power and configuration status.
*GSP/MP provides power control,system reset,and Transfer Of Control (TOC) capabilities.

Note: This GSP/MP is similar to Oracle Sun™ Advanced Lights Out Manager (ALOM)