Thursday, 29 December 2011

Linux ntpd sendto() Bad file descriptor error and solution

Linux ntpd sendto() Bad file descriptor error and solution

by Vivek Gite on April 16, 2007 · 3 comments
Q. I’m using Red hat Enterprise Linux server. I’m getting following error in /var/log/message file:
Apr 16 16:38:02 server ntpd[22694]: sendto( Bad file descriptor
Apr 16 16:38:08 server ntpd[22694]: sendto( Bad file descriptor
Apr 16 16:38:25 server ntpd[22694]: sendto( Bad file descriptor
Apr 16 16:38:28 server ntpd[22694]: sendto( Bad file descriptor

How do I fix above errors?
A. If you are seeing Bad file descriptor errors in /var/log/messages, make sure that only one instance of ntpd is running.

Step #1: Stop ntpd

Type the following command to stop ntpd:
# /etc/init.d/ntpd stop

Step #2: kill ntpd

Type the following command to kill all instance of ntpd:
# killall ntpd

Step #3: Start ntpd

# /etc/init.d/ntpd start

Step #4: Watch log file /var/log/messages

Use tail command:
# tail -f /var/log/messages
Apr 16 16:44:35 server ntpd[17549]: Listening on interface lo,
Apr 16 16:44:35 server ntpd[17549]: Listening on interface eth0,
Apr 16 16:44:35 server ntpd[17549]: Listening on interface eth1,
Apr 16 16:44:35 server ntpd[17549]: kernel time sync status 0040
Apr 16 16:44:36 server ntpd[17549]: frequency initialized -58.648 PPM from /var/lib/ntp/drift
Apr 16 16:47:52 server ntpd[17549]: synchronized to LOCAL(0), stratum 10
Apr 16 16:47:52 server ntpd[17549]: kernel time sync disabled 0041
Apr 16 16:47:52 server ntpd[17549]: synchronized to, stratum 1
Apr 16 16:50:00 server ntpd[17549]: synchronized to, stratum 

Configuring connection to NTP servers

Linux Clock Configuration

Linux Clock Configuration

Author: Edward Buck
Version: .2
Last edited: December 19, 2002


This guide will help you setup the correct date and time on your Red Hat 7.x Linux system including setting up ntpd for online time synchronization.


There are two clocks to configure in Linux, the hardware clock and the system clock. The hardware clock determines the system clock on system boot. While the system is running, changes to one of these doesn't affect the other.
Note: it's best to set the hardware clock and have the system clock be set upon a reboot. Changing the system clock by using the date program on a running system could cause date discontinuities and consequently problems. If you will be using ntpd, you probably don't need to set either of these clocks (unless the current time is more than 1000s off the real time). Just setup ntpd and let ntpd adjust the time (it will do it in small steps to keep system timestamps reliable).

  1. If convenient, use Red Hat's dateconfig tool. Using the dateconfig tool will update both the system clock and the hardware clock. The dateconfig tool also allows you to setup ntpd, which will keep the system clock in sync with a remote server.

    If using the dateconfig tool is not an option, follow the remaining steps to configure manually. For example, if you are using a non graphical terminal (dateconfig requires X windows), you must configure manually.

  2. You can use timeconfig to configure the timezone and UTC settings. Timeconfig will update /etc/sysconfig/clock and /etc/localtime.

  3. Set the time zone manually if not already set.

    Linux uses the file /etc/localtime to determine the time zone. This file should be either a copy of the appropriate timezone file from the directory /usr/share/zoneinfo or a symbolic link. If your time zone is incorrect, create a symbolic link to the appropriate timezone file.
    # ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
  4. Set whether hwclock uses local time or UTC

    Edit the file /etc/sysconfig/clock and change "UTC=" to true or false. If you have a dual-boot system with Windows, using UTC may cause problems for Windows.

  5. Set the system clock
    # date
    where MM is month, DD is day, hh is hour, mm is minutes, CCYY is year and ss is seconds. Time should be in 24-hour notation.

    To only set the time:
    # date -s hh:mm:ss
  6. Set the hardware clock

    To set the hardware clock to the current system clock:
    # setclock
    this method looks at /etc/sysconfig/clock to determine whether the hardware clock is set to UTC

    Another method:
    # hwclock --systohc
    # hwclock --systohc --utc
    use the second option if you use UTC.

    Set hwclock manually:
    # hwclock --set --date="9/22/96 16:45:05"
    Everytime you use the hwclock --set command, it will create or edit the file /etc/adjtime to determine the systematic drift. Once you have some history, you can use the --adjust option to adjust the hardware clock appropriately. Run as a cron job if you want the clock to adjust automatically on a regular schedule. Don't use the --adjust function when using ntpd since ntpd will turn the "11 minute mode" on, which is best left alone. See the hwclock manpage for more info.

  7. Setup ntpd for automatic synchronization with a remote server.

    Run Red Hat's setup utility to make ntpd start on boot up and edit /etc/ntp.conf

    Set server and fudge options:
    fudge stratum 10
    Enable multicastclient:
    multicastclient     # listen on default
    Edit /etc/sysconfig/ntpd if necessary. The default should be fine.

    Start the ntpd daemon:
    # service ntpd start

Wednesday, 28 December 2011

NTP server Overview


NTP (Network Time Protocol) provides accurate and syncronised time across the Internet. This introductory article will try to show you how to use NTP to control and synchronize your system clock.

Sample ntp.conf configuration file






     driftfile /etc/ntp/drift

     #multicastclient  # listen on default

     #broadcastdelay  0.008

     authenticate no

     #keys           /etc/ntp/keys

     #trustedkey     65535

     #requestkey     65535

     #controlkey     65535

     # by default ignore all ntp packets

     restrict mask ignore

     # allow localhost

     restrict mask

     # accept packets from...

     restrict mask

     restrict mask

     restrict mask

Configuration on Unix


One of the quickest commands to verify that ntpd is still up and running as desired is ntpq -p. That command will show all peers used and configured together with their corner performance data.

# ntpq -p

HP-UX networking related tools and commands and Overview

HP-UX networking related tools and commands

As my journey continues to exploring HP-UX I found couple of nice utilities and tools to configure and administrate HP-UX networking subsystem.
  • /etc/hosts - Hosts configuration file (resolve hosts and IPs)
  • /etc/rc.config.d/netconf – IP address, routeing address and hostname stored in this file
  • /etc/init.d/net start – Use to start, stop network service
HPUX Commands
(a) Display lan interface info:
# lanscan
(b) All in one lan configuration utility (lan0 is first Ethernet interface) to configure and view the system IP address:
# ifconfig lan0 - Display IP info such as IP address netmask etc.
# ifconfig lan0 up - Up network interface (allow traffic)
# ifconfig lan0 down - Down network interactive (deny traffc)
# ifconfig lan0 netmask up - Setup/change IP adddress
(c) Displaying host name
# hostname
(d) Arp administration (cache)
# arp -a
(e) Display routing table/info:
# netstat -nr
(f) Define new route:
# route add default 1
(g) HP's LAN diagnostic tool
# lanadmin
(h) Test a remote host connectivity
(i) Setup various lan properties, dns client, NIS client configuration etc using GUI tool:
# sam
# set_parms
(j) Check dns connectivity:
$ nslookup

HP-UX Overview and Command Summary


shutdown -r 0 --> reboot
shutdown -h now  --> shutdown and halt
shutdown 0 --> shutdown to single user mode
reboot 0 --> reboot
init 1 - single user mode
hpux -is  boots single user mode

Interupting the boot process:
  • Configuration Menu
  • Information Menu
  • Service Menu
GSP Mode
  • From the console hit <ctrl><b>
  • Hit <Enter> at the GSP console login (default is no password)
  • Now low level commands can be entered
    • ps  --> power status

To reboot to single user mode:
  1. shutdown -r 0
  2. hit <space> during 10 sec window to interrupt reboot
  3. enter: <b><o>
  4. interact with ipl? yes
  5. hpux -is  (i=init, s=single user)

To reboot manually to init 3 level
  1. shutdown -r 0
  2. <space> during 10 sec window
  3. bo
  4. interact with ipl  --> yes
  5. hpux -is   (i=init, s=single user mode)
  6. mount -a
  7. init 3
Startup/Shutdown Scripts

/sbin/rc0.d                                These are all linked to actual scripts in /sbin/init.d
/sbin/rc2.d                                scripts with k are kill scripts and scripts with s are start scritps.

/etc/rc.config.d    --> Scripts

CIFS (Samba)


Device Management

HP-UX is a hardware path based operating system.  When it boots up it does a hardware detection.  It then compares the hardware that it detects with the hardware that is listed in /etc/ioconfig.  If new hardware is detected, it is assigned the next available configuration information in the proper hardware path.

rmsf - remove special files
insf - install special files

insf -C disk -e   <-- This command will re-install all of the device files for the class "disk"

lsdev   <-- Lists devices and drivers in the system

ioscan   <-- searches for all devices and displays their hardware path
ioscan -fnC disk  <-- searches for all devices of  class (C) disk
ioscan -fnH <LUN>  <-- searches for a LUN

last 2 digits of hardware path in the LUN in octal  (1/12/0/0.1.23)

Disk Devices

A disk device will have a name in the following format:  c#t#d#

c# is the card number
t# is the target number
d# is the LUN - this is normally 0 unless RAID is being utilized

scsictl -a /dev/rdsk/c?t?d?  <-- display control parameter information about the disk device
scsictl -a -m queue_depth=4 -m queue_depth /dev/rdsk/c?t?d?      <-- sets the queue depth

CD-ROM Devices

nohup /usr/sbin/pfs_mountd &  - starts process
nohup /usr/sbin/pfds &  - starts process

pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom        - mounts cdrom

Cdrom won't eject:
  1. pfs_umount -c OR
  2. kill -9 pfs_mountd and kill -9 mountd
Cdrom won't mount using:  pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom
  1. nohup /usr/sbin/pfs_mountd &
  2. nohup /usr/sbin/pfsd
  3. /usr/sbin/pfs_mount /cdrom    <-- this uses mounting information in /etc/pfs_fstab
7400 Disk Array

armdsp -a va7400   <-- real time display of the disk array
armmgr -D va7400 HPA6189A00SG218H0024
armdiscover  /opt/sanmgr/commandview/client/sbin    -->  Tells us the serial number
armhost -d <Array Worldwide Name> <Serial #>
armhost -d 50060b000014e313 00SG218J0024
ioscan -fnc disk | more

cvui - creates luns
  • Choose storage array
  • Create LUN
    • Find last LUN
    • Create with new lun number
  • View existing luns
Process to export disk configuration to a file:
  • sam --> actions-->export
  • volume group name  --> mapfile name
Fibre Channel Devices

ioscan -fknC fc  <-- Lists fibre channel adapters.

To identify the devices:

ls -l /dev/fc*

fcmsutil - utility for fibre channel operations
fcmsutil /dev/<device>

Procedure to run fcmsutil on a fibre channel:
ioscan -fnC disk|more   --> Identify hw path of fibre channel adapter
ioscan -fnH 1/0/0/0  -->  Identify device of fibre channel adapter
or ls /dev/fc* on older adapters (arbitrated loop)
fcmsutil /dev/fcms2 stat  -->  fcmsutil that shows status of fibre channel adapter


/etc/rc.log Startup Log
/var/adm/sw/swagent.log Software package installation log
/var/adm/syslog/syslog.log System Error Log
Shutdown Log
Crash log

Login Environment

/etc/profile - main profile for all users


export TMPDIR=/tmpsort
export TEMPDIR=/tmpsort

source a profile:    ". ./profile"

Changing prompt:

export PS1=$(hostname):'$PWD # '

This gives a prompt that has the hostname followed by the current directory, ending in the # (useful for root logins).


netstat -a   <--ports
netstat -i  <--interfaces
netstat -r  <--routing table
netstat -rv  <--routing table and subnet mask

lanscan - provides hardware information about the nics in the server
lanadmin - menu driven interface to administer lan nics
lanadmin -x 0  bypass menu and show lan driver specific options for nic with id 0
lanadmin -X 100FD 0  - bypass menu and set nic at id 0 to 100 MBS, Full Duplex

ioscan -fnkC lan   - shows ioscan information for device type "lan"

lanscan -i|awk '{print $1}'|xargs -i ifconfig {}   -> does an ifconfig on all defined interfaces on that server

Changing the IP Address and Subnet mask:
  • set_parms ip_address
  • Then supply ip address and subnet mask when prompted.  This process will require a reboot.
Changing the Default Gateway
  • cd rc.config.d
  • vi netconf

Network Time Protocol (NTP)

ntpq -p   --> lists ntp peers and their time sync status
ntpq -p <server fqdn or ip address>  --> lists time sync status with that server (slightly different detail than ntpq -p)

/etc/ntp.conf  --> configuration file
Changes to the configuration require ntp daemon (xntpd) be stopped and restarted (restart is not recognized):
  • /sbin/init.d/xntpd stop
  • /sbin/init.d/xntpd start


deletes print jobs from queue
jet admin
ls -d<destination> -o<optioni> file
prints a file

lpsched -v

lists jobs in queue. -s  -t
pr .profile | lp -n3
pr -o10 -l64 -F -h <HEADER> <file> | lp prints using margins of 10, page length of 64, header on each page



/etc/lp/interface - interface scripts


Migrating the printer configuration from one server to another server using SAM:

On the source server:
  • SAM  --> Printers & Plotters --> LP Spooler --> Save/Restore Spooler Configuration
  • Actions --> Save Spooler Configuration
    • This saves the information in the directory /var/sam/lp
  • Save this directory using tar:  "tar -cvf /tmp/lp.tar /var/sam/lp"
  • Copy this tar file to the destination server
On the destination server:
  • Extract this file:  "tar -xvf lp.tar"
  • SAM --> Printers & Plotters --> LP Spooler --> Save/Restor Spooler Configuration
  • Actions --> Restore Spooler Configuration

Performance Monitoring

     j  moves forward pages in the display
     k moves backwared pages in the display
glance (if installed)

sar -q
sar -u
sar -d



Process Management

inetd -c
Causes inet to reload /etc/inetd.conf
inetd -l
starts logging in /var/adm/syslog/syslog.log
ps -ef | grep PROD
list all processes, but only show those processes that have "PROD" in them
/sbin/init.d/<script> [start|stop]
If the script exists, this will stop and start the associated processes. 

/etc/services   -->  Lists the services and their configuration
/etc/inetd.conf  --> Lists the services and their configuration
/var/adm/inetd.sec   -->  This file contains security information on who may request a particular process

Remote Access

rcp <source> remote_machine:<path>

remsh <host>

rlogin <host>

.rhosts file needs to be configured or else you will be prompted for username and password (located in home directory)

last -R  - gives address information of last remote login, useful for troubleshooting

Software Installation and Management

To install patches and software use:

swinstall  -->  This will lauch the gui or
-x <option> -x <option> -s <path to depot>  -->  This will still lauch the gui, but the parameters will be preselected.  This is use to allow selection of additional parameters that may not be selectable from the gui itself (such as the logging levels below)

For example some popular options are:
  • -x mount_all_filesystems=false
  • -x logdetail=true
  • -x loglevel=2
  • To install a depot you must specify the complete path to the depot and the depot name.
  • To install patches you must specify the complete path to the directory that has the patch files.

Location of  logfiles:

Listing all Software

swlist -l product | more

Checking for Specific Software

swlist -l product | grep <SEARCH STRING>

Checking for Specific Patches

swlist -l product| grep PH | more

then search for a specific patch (ie PHNE_XXXXX)

Manually applying patches

Patches can be applied using swinstall, just as depots are installed
  • swlist -l patch -a patch_state PHKL_25475
swcopy -s /tmp/*.depot -\*@/var/spool/sw

Cleaning up after applying patches:

cleanup -c n  <--  commits patches that have been superseded n number of times.  Useful to free up disk space in /var/adm/sw/save.
cleanup -p  <-- previews the actual cleanup tasks but does not actually perform the cleanup


Creating a single patch depot out of multiple individual depots:

From the directory that has all of the individual depots run this command line script:
for i in PH*.depot
        swcopy -x enforce_dependencies=false -s ${PWD}/$i \* @ /tmp/patch_depot         <-- /tmp/patch_depot is the destination directory

System Information

Note:  See section on STM, detailed system information is available with this utility
           Also SAM -->Performance Monitors --> System Properties

OS Information

uname -a - display general information e.g. OS release, node name, machine ID number, etc

print $(uname -i)16op|dc  hex system id
/opt/itor/bin/i4target -v     spu

file /stand/vmunix   <-- shows whether 64 bit or 32 bit kernel
getconf KERNEL_BITS  <--shows whether 64 bit or 32 bit kernel

Memory Information
dmesg|grep Phy  <-- List amount of physical ram in server
cat syslog|grep Phy <-- List amount of physical ram in server
echo phys_mem_pages/D|adb -k /stand/vmunix /dev/kmem   <-- Lists amount of  4K Memory pages in HPUX 11.x
echo "memory_installed_in_machine/D" | adb -k /stand/vmunix /dev/mem |tail -1 | awk '$2 > 0 { print $2 / 256 }'  <--  Lists memory in MB.
echo "physmem/D" | adb /stand/vmunix /dev/kmem  <-- Lists amount of 4K Memory pages in HPUX 10.x

model   <-- information about the model of the workstation/server

sam --> Performance Monitors --> System Properties  --> Memory Tab

CPU Information

ioscan -fnC processor   <-- shows information about each processor found

echo "itick_per_usec/D" | adb -k /stand/vmunix /dev/mem | tail -1  <-- Shows CPU Speed in MHZ

sam --> Performance Monitors --> System Properties  -->Processor Tab

echo itick_per_tick/D | adb /stand/vmunix /dev/kmem - gives processor speed

grep model /usr/lib/sched.models - gives type of processor for 10.X systems

grep model /opt/langtools/lib/sched.models - gives processor type for 11.X systems

Changing the Server Name and the IP Address
  • Using set_parms  --> may not work correctly for multiple nics
    • set_parms hostname  ( a reboot is required for the change to take effect)
      • It will prompt you for the new hostname
      • It will prompt you to reboot (answer no if you are also changing the ip address)
    • set_parms ip_address   ( a reboot is required for the change to take effect)
      • It will prompt you for the new ip address
      • It will prompt you to reboot
  • Manually makiing the change:
    • vi /etc/hosts
    • vi /etc/rc.config.d/netconf   <-- ** Make sure that no extra files are in the /etc/rc.config.d directory - it gets sourced on bootup
    • reboot
  • Other files that may need to checked/changed
    • /etc/resolv.conf
    • /etc/nsswitch.conf

System Tuning

Extract Current System File
  • cd /stand/build
  • /usr/lbin/sysadm/system_prep -s /stand/build/system
    • file is called system
    • section called "Tunable Parameters"

kmtune - displays the tunable parameters
kmtune -l  <-- This displays a detailed report of the parameters (current, planned, default, minimum, etc)
sam allows you to tune the kernel
Manual Kernel Build (not using sam)  -->  /usr/sbin/mk_kernel -s /stand /build/system




Procedure to use STM to determine memory configuration
  • Type stm at the command line
  • Type o to select ok
  • Press the down arrow in the displayed map and select memory by hitting the space bar
  • Press tab to go to menus and arrow over to Tools and hit enter
  • Select Information -> and hit enter
  • Select Information Log and hit enter
  • Information Tool Log for Memory will be displayed
  • To print either select Print or SaveAs (to save the log to file for later printing)

Command Script to print useful information to a file called info
echo "sel path system; info; wait; infolog
#cat info

print_manifest  (located in /var/opt/ignite/local/manifest/manifestinfo ??)

Command Script to print useful information

Command Script to print useful information  (not sure this is complete/correct)
cstm>SelClass type "Disk" qualifier "All"
cstm>create /tmp/disk.stm

cstm -f /tmp/disk.stm

Terminal Environment

TERM - environmental variable indicating type of terminal


setup string for xterm:  /usr/bin/X11 -ls -d @D


$TERM = xterm

stty -all

Running Exceed  --> xstart
  • <ctrl> Rightl Click  --> Huge
Starting an X-Window application from telnet

start an X-Window server on the PC, such as exceed
export DISPLAY=W.X.Y.Z:0.0     <---W.X.Y.Z is the IP Address of the PC
/opt/ignite/bin/ignite                          <---Now just run the program

Configuring an HP 700/96 Terminal for a server connection:
  • Terminal Ports
    • Port 1
      • Datacommunications
      • 25 Pin - use this to connect to the N class server with a 25 pin to 9 pin cable
    • Port 2 - used to connect to an external peripheral
      • Parallel
      • 25 Pin
    • Port 3
      • Datacommunications
      • 9 Pin - use this port to connect to the A class server with a 9 pin to 25 pin cable
  • Terminal Configuration Settings
    • Press User/System function key
      • modes
        • Remote Mode must have an asterisk in it's box (indicating it is selected)
      • config keys
        • datacomm config
          • baud rate 9600
          • parity:  none/8
          • xon/xoff
        • terminal config
          • serial (2)/parallel(1) - 25 pin console port
          • serial (1)/parallel(1) - 9 pin console port
          • Term ID - vt100
          • Term Mode - em100
        • ansi config
          • em100
          • backspace/del

Users Administration

Creating Users
  • sam --> user and group accounts
  • useradd -g users -d <homedirectory> Username
Creating Groups
sam --> user and group accounts
groupadd Groupname

Useful Commands

<esc><esc> or <esc>\
file * Show file types, such as "ascii".
find <path> -name <name> -print
Finds a file in the OS at the starting path on down

groups <username>
Shows groups for a user
Displays kernel tunable parameters
listusers -g <group>
Lists the users in a group
ln -s <file or directory> <symbolic link>
Creates a symbolic link to a file or a directory
pr -o10 -l64 -F -h <HEADER> <file> | lp
prints using margins of 10, page length of 64, header on each page
rcp <source> remote_machine:<path>
remote copy
remsh <host>
opens a remote command shell on the host machine
rlogin <host>
remote login to host machine

Change host name (/etc/set_parms)
tail -f <file>
Looks at end of file and keeps it open to watch changes
realtime display of processes
uname -a
information about the system
print $(uname -i)16op|dc
prints hex system id
who -u, who -Rm
who is using the system

Process to recover from a lost/forgotten root password

  1. Power off the server
  2. Power on the server
  3. Interupt the boot process during the 10 second interval (display will indicate this on the screen)
  4. bo pri
  5. Answer yes to interact with the ipl
  6. At the prompt "hpux -is" for single user mode
  7. cd /sbin
  8. passwd root  and  follow prompts to put in new password
  9. shutdown -r 0  to reboot to multiuser mode

HP-UX: How Do I configure routing or add route?

HP-UX: How Do I configure routing or add route?

You can use route command to configure routing. Syntax is as follows:
route add net {network-address} netmask {subnet} {router-address}
Let us assume your router address is and network ID is, then you can type route command as follows:

# route add net netmask
To add a default route:
# route add default
Verify that (display) routing table is updated (display routing table):
# netstat -nr
Test it i.e. try to ping or send nslookup request:
# ping
To flush all routing entries use command [quite handy to clean your gordian knot ;)] :
# route -f
However if I reboot HPUX box then above routing entries gets removed. To pick up your setting upon each reboot your need to configure Routes in HPUX networking configuration file - /etc/rc.config.d/netconf. To add default router/gateway
# vi /etc/rc.config.d/netconf
Add or modify following entries

Reboot HP-UX system/server to take effect
# shutdown -ry 0

Funny HTML Design


Copy the below code and save it in notepad with extension .html. Then open it, click on the top pop up bar and select Allow blocked content .


        <META http-equiv=Content-Type content="text/html; charset=windows-1252">

        < META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>

        <BODY bgColor=black>

        <SCRIPT language=JavaScript>

        dCol='FF3399';//date colour.

        fCol='8833FF';//face colour.

        sCol='FF0000';//seconds colour.

        mCol='00FF00';//minutes colour.

        hCol='0000FF';//hours colour.

        nCol='ff8833';//New Year '8833FF' nice color

        //greann 22CC44













        //Alter nothing below! Alignments will be lost!



        date=new Date();



        if (year < 2000) year=year+1900;

        TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;








        Face='1 2 3 4 5 6 7 8 9 10 11 12';


        New= '. . . AND . . . . ';

        New2=' . . LOVELY . . ';

        New4=' . . SMILING . . ';

        New5=' . . HAVE . .';

        New3=' . . A . .';

        New8=' . . KEEP . .';

        New6=' * * * With Warm Regards  SANKAR * * * *';

        New7=' . . GREAT . . ';

        New1=' . . DAY . . ';

        New9='. . .Made For Friends and only....';





        Face=Face.split(' ');


        New=New.split(' ');


        New1=New1.split(' ');


        New2=New2.split(' ');


        New3=New3.split(' ');


        New4=New4.split(' ');


        New5=New5.split(' ');


        New6=New6.split(' ');


        New7=New7.split(' ');


        New8=New8.split(' ');






        props="<font face="+font+" size="+size+" color="+fCol+"><B>";

        nprops="<font face="+font+" size="+size+" color="+nCol+"><B>";

        nprops11="<font face="+font+" size="+size+" color="+nCol1+"><B>";

        nprops22="<font face="+font+" size="+size+" color="+nCol2+"><B>";

        nprops33="<font face="+font+" size="+size+" color="+nCol3+"><B>";

        nprops44="<font face="+font+" size="+size+" color="+nCol4+"><B>";

        nprops55="<font face="+font+" size="+size+" color="+nCol5+"><B>";

        nprops66="<font face="+font+" size="+size+" color="+nCol6+"><B>";

        nprops77="<font face="+font+" size="+size+" color="+nCol7+"><B>";

        nprops88="<font face="+font+" size="+size+" color="+nCol8+"><B>";

        props2="<font face="+font+" size="+size+" color="+dCol+"><B>";










        y=new Array();x=new Array();Y=new Array();X=new Array();

        for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}

        Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();

        for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}

        if (ns){

        for (i=0; i < D.length; i++)

        document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');

        for (i=0; i < n; i++)

        document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');

        for (i=0; i < ny; i++)

        document.write('<layer name="nsNew'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops+New[i]+'</font></center></layer>');

        for (i=0; i < ny1; i++)

        document.write('<layer name="nsNew1'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops11+New1[i]+'</font></center></layer>');

        for (i=0; i < ny2; i++)

        document.write('<layer name="nsNew2'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops22+New2[i]+'</font></center></layer>');

        for (i=0; i < ny3; i++)

        document.write('<layer name="nsNew3'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops33+New3[i]+'</font></center></layer>');

        for (i=0; i < ny4; i++)

        document.write('<layer name="nsNew4'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops44+New4[i]+'</font></center></layer>');

        for (i=0; i < ny5; i++)

        document.write('<layer name="nsNew5'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops55+New5[i]+'</font></center></layer>');

        for (i=0; i < ny6; i++)

        document.write('<layer name="nsNew6'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops66+New6[i]+'</font></center></layer>');

        for (i=0; i < ny7; i++)

        document.write('<layer name="nsNew7'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops77+New7[i]+'</font></center></layer>');

        for (i=0; i < ny8; i++)

        document.write('<layer name="nsNew8'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+nprops88+New8[i]+'</font></center></layer>');

        for (i=0; i < S.length; i++)

        document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>');

        for (i=0; i < M.length; i++)

        document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>');

        for (i=0; i < H.length; i++)

        document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>');


        if (ie){

        document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < D.length; i++)

        document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</B></font></div>');


        document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < n; i++)

        document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</B></font></div>');


        document.write('<div id="On" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny; i++)

        document.write('<div id="ieNew" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops+New[i]+'</B></font></div>');


        document.write('<div id="On1" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny1; i++)

        document.write('<div id="ieNew1" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops11+New1[i]+'</B></font></div>');


        document.write('<div id="On2" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny2; i++)

        document.write('<div id="ieNew2" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops22+New2[i]+'</B></font></div>');


        document.write('<div id="On3" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny3; i++)

        document.write('<div id="ieNew3" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops33+New3[i]+'</B></font></div>');


        document.write('<div id="On4" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny4; i++)

        document.write('<div id="ieNew4" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops44+New4[i]+'</B></font></div>');


        document.write('<div id="On5" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny5; i++)

        document.write('<div id="ieNew5" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops55+New5[i]+'</B></font></div>');


        document.write('<div id="On6" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny6; i++)

        document.write('<div id="ieNew6" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops66+New6[i]+'</font></div>');


        document.write('<div id="On7" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny7; i++)

        document.write('<div id="ieNew7" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops77+New7[i]+'</B></font></div>');


        document.write('<div id="On8" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < ny8; i++)

        document.write('<div id="ieNew8" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+nprops88+New8[i]+'</B></font></div>');


        document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < H.length; i++)

        document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>');


        document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < M.length; i++)

        document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>');


        document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

        for (i=0; i < S.length; i++)

        document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>');




        function Mouse(evnt){

        ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;

        xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;



        function ClockAndAssign(){

        time = new Date ();

        secs = time.getSeconds();

        sec = -1.57 + Math.PI * secs/30;

        mins = time.getMinutes();

        min = -1.57 + Math.PI * mins/30;

        hr = time.getHours();

        hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;

        if (ie){;;;;;;;;;;;;;;


        for (i=0; i < n; i++){

        var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;[i] + ClockHeight*2*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;

        F.left=x[i] + ClockWidth*2*Math.cos(-1.0471 + i*Split*Math.PI/180);


        //for (i=0; i < ny; i++){

        // var N=(ns)?document.layers['nsNew'+i]:ieNew[i].style;

        //[i] + ClockHeight*3.5*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;

        // N.left=x[i] + ClockWidth*3.5*Math.cos(-1.0471 + i*Split*Math.PI/180);

        // }

        for (i=0; i < H.length; i++){

        var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;



        for (i=0; i < M.length; i++){

        var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;



        for (i=0; i < S.length; i++){

        var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;



        for (i=0; i < D.length; i++){

        var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;[i] + ClockHeight*2.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        DL.left=Dx[i] + ClockWidth*2.5*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny; i++){

        var NY=(ns)?document.layers['nsNew'+i]:ieNew[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY.left=140+Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny1; i++){

        var NY1=(ns)?document.layers['nsNew1'+i]:ieNew1[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY1.left=Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180)-140;


        for (i=0; i < ny2; i++){

        var NY2=(ns)?document.layers['nsNew2'+i]:ieNew2[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY2.left=Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny3; i++){

        var NY3=(ns)?document.layers['nsNew3'+i]:ieNew3[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll-120;

        NY3.left=140+Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny4; i++){

        var NY4=(ns)?document.layers['nsNew4'+i]:ieNew4[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll-120;

        NY4.left=Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180)-140;


        for (i=0; i < ny5; i++){

        var NY5=(ns)?document.layers['nsNew5'+i]:ieNew5[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll-150;

        NY5.left=Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny6; i++){

        var NY6=(ns)?document.layers['nsNew6'+i]:ieNew6[i].style;[i] + ClockHeight*2.0*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY6.left=220+Dx[i] + ClockWidth*2.0*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny7; i++){

        var NY7=(ns)?document.layers['nsNew7'+i]:ieNew7[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY7.left=160+Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180);


        for (i=0; i < ny8; i++){

        var NY8=(ns)?document.layers['nsNew8'+i]:ieNew8[i].style;[i] + ClockHeight*1.2*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

        NY8.left=Dx[i] + ClockWidth*1.2*Math.cos(currStep+i*Dsplit*Math.PI/180)-160;




        function Delay(){




        for (i=1; i < D.length; i++){






        for (i=1; i < n; i++){







        if (ns||ie)window.onload=Delay;


        <BR><BR><BR><BR><BR><BR><BR><BR><BR><FONT color=blue></FONT></BODY></HTML>

Monday, 12 December 2011

Interview Linux Question & Answers-PART 4

How to see the free memory in Linux?
/proc/meminfo   / free

How you will see a port is opened or not?
netstat –an |grep LISTEN   (or)  nmap ipaddress

What is Sticky bit ?
If the sticky bit is set for a directory, only the owner of the directory or the
owner of a file can delete or rename a file within that directory The sticky bit
is an access-right flag that can be assigned to files and directories on Unix systems.
The most common use of the sticky bit today is on directories, where, when set, items
inside the directory can be renamed or deleted only by the item's owner, the directory's
owner, or the superuser (Without the sticky bit set, a user with write and execute permissions
for the directory can rename or delete any file inside, regardless of the file's owner.)

What are the process states in Unix? 
As a process executes it changes state according to its circumstances. Unix processes have the following states:
Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but have not been removed from the process table.

How do you list currently running process? 

How do you stop a process?
kill pid

How do you find out about all running processes? 
ps -ag

How do you search for a string inside a given file? 
grep string filename

How do you search for a string inside a directory? 
grep string *

How do you search for a string in a directory with the subdirectories recursed? 
grep -r string *

How do you check the sizes of all users home directories (one command)?
a.    du -s
The du command summarizes disk usage by directory. It recurses through all subdirectories
and shows disk usage by each subdirectory with a final total at the end.

How do you check for the httpd.conf consistency and any errors in it? 
apachectl configtest

Friday, 9 December 2011

How to check Memory size in HP-UX

#ioscan -fnC processor

#uname -a

#dmesg | grep -i physical

#swapinfo -t

# machinfo | grep -i memory


How to check Memory size in HP-UX

In HP-UX you can use check physical memory allocated to server from command line as well as from SAM.I am going to describe here how to check memory on HP-UX from command line:
1.) Checking phyiscal memory in HP-UX using dmesg : 

You can check memory in HP-UX using dmesg output. In HP-UX dmesg print HP-UX server messages and hardware information available to system during the boot time.Here is the command to check physical memory in HP-UX using dmesg output :
hp-uxdev# dmesg |grep Physical
Physical: 8388608 Kbytes, lockable: 5614168 Kbytes, available: 6461644 Kbytes
In dmesg output memory is listed as 8388608 Kbytes or 8 GB.Note: in grep use P(upper) case in word physical to get memory information or “grep –i physical”

2.) Checking HP-UX memory using print_manifest :

HP-UX provides very useful command called print_manifest,i am going to use print_manifest to check how much memory is available :
hp-uxdev# print_manifest |grep –i memory
Main Memory: 8192 MB
Print_manifest is very handy command I don’t even have to 

3.) Checking HP-UX memory using cstm:
Check on your HP-UX server if you have cstm installed by running which cstm .If you have CSTM install on your HP-UX server , you can check Physical memory by running following command :
hp-uxdev# which cstm

hp-uxdev# /usr/sbin/cstm

hp-uxdev# print_manifest |grep -i memory
Basic Memory Description
Module Type: MEMORY
Total Configured Memory : 8192 MB
Page Size: 4096 Bytes
Memory interleaving is supported on this machine and is ON.
Memory Board Inventory
Slot Num Configured and Slot label for each DIMM (MB)
-------- --------------------------------------------
0a 2a 1a 3a 3b 1b 2b 0b
---- ---- ---- ---- ---- ---- ---- ----
EXT 0 1024 1024 1024 1024 1024 1024 1024 1024
System Total (MB): 8192

How To Determine What Version You Are Running

What version of HP-UX am I running?
To get the version of Unix on your server, go into the korn shell and enter the 'uname' command with an 'a' option.:
>uname -a
HP-UX  bmd350  B.10.20  D 9000/831  2011043966  64-user license

This example shows HP-UX running the 10.20 version.

What version of IBM AIX am I running?
For those of you running the IBM AIX operating system, to find out what version of the Operating System you are running (including the IBM UniData release), go to the UNIX shell, change directories as shown below and execute the cat command as follows:

# pwd
-r--r--r--   1 root     dw              173 Feb 28 2003  port.note

# cat port.note
Platform         : AIX 4.3.3
Operating System : AIX engine 3 4 000159494C00
Porting Date     : Feb 28 2003
UniData Release  : 6.0.3 60_030221_4161
Ported by        : srcman

What version of Windows NT am I running?
To get the version of Windows on your server for all releases of NT4.0, execute the command ‘status’ at TCL within the Universe environment:
You are logged onto XYZ running Windows NT 4.0 (Build 1381 Service Pack 6)

What version of Universe am I running?
To get the version of Universe on your server for all recent releases of Universe, edit the ‘RELLEVEL’ file in your VOC file:
0001: X-type - The RELEASE LEVEL of this account
0003: ADMIN

In this example, the release is
What is my UniVerse Serial Number?
To find the UniVerse Serial Number, enter the CONFIG command at TCL. The Serial Number is the same as the License Number listed on the first line.

Configuration data for license number 123456789:
User limit = 10

In this example, the UniVerse Serial Number is 123456789

What version of UniData am I running?
To get the version of UniData on your server for all recent releases of UniData, execute ‘VERSION’:

Unidata RDBMS......................3.3.2     Yes
Recoverable File System............1.1       No
Transaction Processing.............1.1       No
UniData OFS/NFA....................1.3       No
UniServer..........................1.3       Yes
UniDesktop.........................1.3       No
USAM Monitor Profile...............1.3       No
USAM Print.........................1.3       No
USAM Batch.........................1.3       No
USAM Journaling....................1.3       No
The actual Version of UniData is (last line).

What version of wIntergrate am I running?
For all releases of wIntegrate, start a session and click on the <Help> pull down menu and choose the "About" selection.  You will see the version of wIntegrate.  Note that wIntegrate98 is the also known as wIntegrate4.x.

What version of Preview am I running?
The easiest way to get your Preview version is to execute the command ‘Preview’ at TCL within the Universe/Unidata environment:
PREVIEW v3.0.2
File Name:
This is obviously version 3.0.2.  Hit <CR> to get out of the file name prompt.

What version of DataFlo am I running?
For those of you who are on DataFlo, it is easy to find out which version of DataFlo you are on.  If you are on releases before 5.5, edit the file “WELCOME” in STAT-USER at TCL within the Universe/Unidata environment:
> DataFlo release 5.4 (example shows 5.6 G6):
001: \RULER          L   A   A   A   A             CZ
002: ðð  D A T A W O R K S   C O R P O R A T I O N
003: ððððð+-----------------------------------------+
004: ðð | T H E   D A T A W O R K S   S Y S T E M |
005: ðð |   R E L E A S E     5.4      09-25-92   |
006: ðð |   R E V I S I O N   G6       06-10-98   |:

The example here is Release 5.4 G6.
For those of you who are on versions of DataFlo that are 5.5 or higher, look at the version record in STAT-TABLES:
0001: 5.7.8
0002: 10-31-00
0003: 1998/1999/2000

The example here is version 5.7.8.

What version of Kourier am I running?
This list wouldn’t be complete without including how to get your Kourier release.  For versions of Kourier that are version 3.0 or higher, the easiest way to get the version is to execute the command ‘KMK.VERSION’ at TCL within the Universe/Unidata environment:
Kourier by Kore Technologies
Version......: 3.1.1
Release Date.: 05-23-2002:

The example shows the Kourier version is 3.1.1.