Just a thought

One of these days I was talking to a friend of mine. I was very morning slow, but I was surprised at my fast reaction to one of his phrases. It went like this:

Friend: I am downloading Windows Longhorn now…

Me: It’s like saying that you’re getting a 26 inch dildo. You’re free to do what you want, but I won’t be too proud of that, you know.

Now, where did that come from?

Reminder about NTP

NTP – Network Time Protocol allows for automatic and precise time synchronization over the network. There are many problems that can be caused by incorrect time – starting from logs confusions and going to software locks due to file timestamps. Configuring NTP is very easy. Just install the ntp RPM that comes with Red Hat or Fedora Linux (or a number of other Linux distributions) and use one of the two modes described below.

  1. Full blown NTP server. In this mode, you’ll have to edit /etc/ntp.conf to specify a number of NTP servers to synchronize time from, as well as a lit of machines that can synchronize time with your server. Usually you’d want to have only one full blown NTP servers per network.
  2. Simple NTP client. This is even easier to configure than the previous mode. All you have to do is add these two commands to your scheduler (cron or similar) to execute hourly.
    /usr/sbin/ntpdate -s ntp_server_ip_or_hostname
    /sbin/hwclock -w
    

While modern computers are very smart and fast, they don’t have any special skills at keeping the time precisely correct. Internal timers get offset by power cuts, CPU usage bursts, and things like that. The daily changes are small, but when left unattended for a longer period of times, clocks can run ahead or stay back for as long as days!

Here is a log record from one of the servers in our office:

21:01:01 ... ntpdate[...]:  ... offset 0.250427 sec
22:01:00 ... ntpdate[...]:  ... offset 0.251682 sec
23:01:01 ... ntpdate[...]:  ... offset 0.251269 sec
00:01:01 ... ntpdate[...]:  ... offset 0.251013 sec
01:01:01 ... ntpdate[...]:  ... offset 0.250451 sec
02:01:01 ... ntpdate[...]:  ... offset 0.250061 sec
03:01:01 ... ntpdate[...]:  ... offset 0.250239 sec
04:01:01 ... ntpdate[...]:  ... offset 0.250313 sec
05:01:00 ... ntpdate[...]:  ... offset 0.250112 sec
06:01:01 ... ntpdate[...]:  ... offset 0.250554 sec
07:01:01 ... ntpdate[...]:  ... offset 0.250691 sec
08:01:01 ... ntpdate[...]:  ... offset 0.249850 sec
09:01:01 ... ntpdate[...]:  ... offset 0.250418 sec
10:01:01 ... ntpdate[...]:  ... offset 0.250070 sec
11:01:01 ... ntpdate[...]:  ... offset 0.250488 sec

As you can see, this machine’s time inconsistencies are as large as quarter of a second per hour, which can result in 6 seconds per day (24 hours). This alone can cause noticable slowdowns in software that counts on time being always correct.

P.S.: There are NTP implementations for other operating systems as well. Google is your friend.

Uptime records

It’s been a while since I checked uptime on few servers that I manage at work. And by “a while” I mean “a while“. Here are five records for you to be impressed.

  1. ldap-master – this server has a pretty easy life. It is a master node of our internal LDAP cluster. All it has to do is answer the queries of about 20 other servers and a couple of web applications.
    [leonid@ldap-master leonid]$ uptime
    2:39pm  up 462 days,  9:19,  3 users,  
    load average: 0.00, 0.00, 0.00
  2. news – this server is under bigger load constantly. It runs as a slave of our internal LDAP cluster. It hosts one of the havier used web applications with database backend. It also runs a news-mail-news gateway, which allows employees to read and post to several heavy mailing lists via a single subscription.
    [leonid@news leonid]$ uptime
    2:40pm  up 455 days, 10:59,  1 user,  
    load average: 0.11, 0.03, 0.01
  3. devzone – this is our main development server. About 20 people are constantly using it. It also hosts one of our RT ticketing systems, as well as a few other web applications. There are also a few processes running in test mode.
    [leonid@devzone leonid]$ uptime
    2:44pm  up 404 days, 13:12, 11 users,  
    load average: 0.07, 0.06, 0.00
  4. gorilla – our main file server. It hosts homes for more than a hundred users. It also has a bunch of file areas accessible via FTP, NFS, and Windows file sharing (SMB). It also hosts mirrors some mirrors of apt repositories and even Tucows. Some of it is also used for network backups.
    [leonid@gorilla leonid]$ uptime
    2:46pm  up 394 days, 10:36,  2 users,  
    load average: 0.00, 0.01, 0.15
  5. backupsrv – this is our backup server. It is one of the most heavier used servers on our whole network. It is responsible for backup and restore of about a hundred hosts and devices. Most of these are done on the daily basis. This server gets most of its reboots from the SCSI equipment errors.
    [leonid@backupsrv leonid]$ uptime
    2:51pm  up 284 days,  6:55,  2 users,  
    load average: 0.00, 0.00, 0.00
    

I checked uptime on several other hosts and all of them are either approaching one year, or passed it already. All of these hosts are running some version of Red Hat distribution. Versions vary from Red Hat Linux 6.2, through Fedora Linux Core 3, to Red Hat Enterprise Linux ES 4.

Finding all executable files on the system

find is one of the most useful and feature rich commands in Linux. Sometimes it is not that obvious which parameters should be fed to find for this or that behaviour. The manual could surely use some work.

Today I was trying to figure out how I can find all executable files on the system. The manual suggests that I use the -perm option with the specification of the mode. Figuring out the mode might get to you, so here is the example:

find / -type f -perm +0111

One could specify any mode what-so-ever. Just remember that 1 stands for ‘execute’, 2 stands for ‘write’, and 4 stands for ‘read’.

“format C:” versus “rm -rf /”

Jokes about “format C:” and “rm -rf /” are pretty frequent in the computer universe. These two commands will supposedely remove all data from the hard disk – one on DOS/Windows and another on UNIX operating systems. While widely used, this might not be exactly true. This guy has tried both and documented the results.