Archive for the 'Linux' Category

Server Submarine

Server Submarine

Have you ever manage servers over internet? Yep! :) There is some pain with this. When you look at the black putty screen and command “reboot”, this is like give a “submerge” command to submarine. “- Submerge! … The system is going down for reboot NOW! …Five, Fore, Three, Two, One, Zero… Check it!”. And if you have a bit of luck you will see login prompt again, in other case server will sink and stop responding. This means that you need to touch data center support or drive to data center. There 1000+ reasons why server may not surface. So there are some simple rules to avoid such things:

  • if you put some scripts, make sure that the syntax correct. You may do this just with sending main commands to standard output
  • use common distribution (more probably it is tested by other people and they report about bugs before you)
  • reboot server after major configuration or software updates( to make sure that you Docbase, or DB will come back )
  • keep your system up-to-date, so it will not unexpectedly crash
  • keep in mind that hardware even less reliable then soft, so duplicate (or backup) your data

Also if you have KVM switch installed this is like a periscope, but into your submarines :) This gives you additional degree of freedom especially when you installing kernel updates.

So server submarine on top… Hip Hip Hooray!

1 Comment »

Destruction Ray

Destrution Ray

Last year I am doing lots of code review, QA and work very close to production. Maybe the most destructive patter I saw during this competition was implemented in the following script:


cd ~/temp
find . -maxdepth 2 -type f -ctime +5 -exec rm {} \;

This script looks quite simple, isn’t it? It deletes some temporary files, which are older then 5 days, really simple, but… with one condition, when ~/temp folder missed because of any reason (NFS share wasn’t mounted or local drive failed or user hasn’t enough rights) this script will delete innocent files in the working directory (in case of cron this more probably will be the user home).

So always define a FULL path in the command which is select files for delete, not rely that the command above change the directory for it and you will not use this pattern.

No Comments »