Sunday, June 26, 2011

TTL (Time to Live)

TTL(Time to Live)... nice term it means “jinda rehna h kabtak”….kidding, actually when a host on an internet send data to a destination it sends it in the form of IP datagram. The datagram has two parts header and the payload, the header contains addressing and control field and the payload contains actual data.

At minimum the header is of 20 bytes long, there are number of fields inside this header, one of them is “jinda rehana h kab tak” field..it is of 8 bit i.e 1 byte field. Time to live is set by the sender of the datagram and it specifies how long the datagram is allowed to “live” on the network, in terms of router hops. Each router decrements the value of the TTL field (reduces it by one) prior to transmitting it.
In theory, time to live is measured in seconds, although every host that passes the datagram must reduce the TTL by at least one unit. In practice, the TTL field is reduced by one on every hop. To reflect this practice, the field is renamed hop limit in IPv6.

If the TTL field drops to zero, the datagram is assumed to have taken too long a route and is discarded. Typically, an ICMP message (specifically the time exceeded) is sent back to the sender to inform it that the packet has been discarded

Saturday, June 25, 2011

difference between crontab -e and crontab -r

the difference between crontab -e and crontab -r is that while crontab -e allow you to edit the cronjob, crontab -r remove the cron file forever..and left you scratching ur head....and more funny thing is if u look at the keyboard the 'e' and 'r' are adjacent..so be very careful, also you can take the back up of all(for each user there is different cron file) the cron from/var/spool/cron.

i will came with lot more if time permits....till then enjoy...:)

directory limit in ext3 filesystem

Today in the morning one of the LAMP developer brought one issue to my notice that one of the script which create new sub-directory inside a directory and uploads the files to the newly created sub-directory is failing. The new files are not getting uploaded through the script.
 I logged in to the server and tried to create one sub-directory but it did not happen. First i checked the space (df -h) on the server and that file system specifically and found there is ample space on the server. Then i run the following command to get the sub-directories count
# ls -altr | wc -l
and found that it is  31998.
The server is Fedora 8 and the file system is ext3. Now the ext3 file system has this limitation that it can has 32000 links per inode. It means that a directory can have 31,998 sub-directories inside it.

To resolve the issue temporarily i removed some older sub-directories before taking their backups and later for permanent solution we put an archiving script at place.