Archive for category Uncategorized
Nothing compares to a traditional tubewell!
Posted by Abbas in Uncategorized on June 26, 2010
What do you guys say? Yea, don’t expect mangoes when you plant papayas.
So, this weekend was really exciting. Had a chance to visit our village with brothers. The most enthusiastic part, of course, a bathe in the traditional tubewell. No matter how advance technology has gone through, no mater what stylish wadding pools you’ve – if you’ve once been under the sheer burst of cool water being pushed from the heart of earth and then pressuring your skin, you’ll be blown out of your mind and would forget modern swimming deluge. If don’t know what it is, it’s just a modified form of a motor water-well pump with a small or large housing reservoir built out of it to hold water for a while but having adjusted drainages that keep water fresh while it flows off to fields to irrigate them, which of course is main purpose of having any pump in village fields.
Ours is just in the middle of mango trees’ garden and it makes the whole adventure quite more fascinating than fun, it sounds
The borehole of well is more than 150 feet and seeing it from top makes your vision a bit dizzy and you can fall off right into it if you’re seeing by bending yourself. I’m afraid of heights but that doesn’t mean I may also be afraid of depths (holly shame-o, lol) but that’s exactly this level of depth does. It’s illusionary. So, I had to sit down, pull my hand above this 20′ diameter of wide-open hole and take a snap from there, lol
But that’s not much scary if you go down by downstairs’ side. Pump that throws water up is a 4HP.
There’s small sort of control room out of it that’s closed most of the times unless there’s a problem. In summer it runs all day usually! Then there’s when fun begins. When you put your head under full speed blowing water, you get your ears and nose full of water. As water in reservoir was full up to my neck and above all its floor was slippery, I really cannot withstand compelling force of blazingly cold water and fell off couple of times. Hilarious but funny as hell! Check out rest of the snaps, while I try to find out a way of eating these mangoes floating on icy water in this bucket. You really don’t get mangoes if you seed papayas
!!!
Highly transparent Squid proxy.
Posted by Abbas in Uncategorized on May 27, 2010
Most of the times you don’t want to show off the proxy server reference in your web requests despite the fact that it’s main purpose of any proxy software, for many reasons. With Squid 2.6, its quite easy to do. Add this to squid.conf.
via off forwarded_for off
And then the below ‘via’ entity would disappear from web header requests being sent from a web browser making recipient webservers unaware of the intermediary proxy location, you’re coming from!
Crontab and Unicode Characters
Posted by Abbas in Uncategorized on May 8, 2010
Crontab in Linux likes to keep its own shell environment and this can really cause frustrating problems with output of your cron jobs if they don’t get fixed as its too much ironic to see not the same behiviour of your shell scripts when they are run in crons than to what you normally see in a bash.
I was running a script that included a few of other scripts and it was not showing unicode characters properly when it ran as in a cron. Solution is to include ‘export LANG=en_US.UTF-8′ in your shell script but the ideal way to do so I found was to pass on this environment variable directly in command parameter of a cron job.
The unicode character that was missing earlier ‘degree‘ symbol became visible as soon as I added the variable LANG=en_US.UTF-8 to crontab’s command.
# crontab -l MAILTO="" 57 9 * * * LANG=en_US.UTF-8 /root/back/hdd-report/report
Linux System Variables
Posted by Abbas in Uncategorized on March 9, 2010
Ever wanted to list down all of system built-in global or local variables stored for your shell? Well, it can be with ‘env‘ and ‘set‘ commands.
The env lists global variables and set lists local ones. Difference between the two is that, global variables are built-in into any shell while local variables include the ones which are set by different applicatons. Such as MAILCHECK (which controls mail checking frequency and informs shell prompt when new mail arrives), only appears in ‘set’ command’s output.
Error Logging to Console
Posted by Abbas in Uncategorized on February 6, 2010
Sometimes when some applications start logging to console, it can really bleed your eyes when something wrong happens. Not mentioning about standard output or standard errors which are rather easily controllable but it could be anything else invoked by kernel such as iptables logging when you would like to log any rules to a log file or default syslog. But “hideously” such applications log to system console too and can surprise you when you plug monitor and see a messy mesh of error loggings all the way back and forth, specifically when a machine is virtual – of course in that case VM would be unresponsive
I was trying to look into syslog.conf to control but found out that this is not what a syslog daemon has dominance over; in fact, needs kernel-level logging modified. And this can be done through either of these ways.
Instruct kernel to log only “errors” instead of informational notifications.
Controlled by ‘printk’ kernel parameter. Defaults are:
# sysctl -a | grep printk
kernel.printk_ratelimit_burst = 10
kernel.printk_ratelimit = 5
kernel.printk = 6 4 1 7
# find /proc -name '*printk*' -exec cat {} \;
6 4 1 7
Just change ’6 4 1 7′ to ’3 4 1 7′.
# echo "kernel.printk = 3 4 1 7" >> /etc/sysctl.conf # sysctl -p
Documentation goes over here, if you’re intrested /usr/share/doc/kernel-doc-2.6.18/Documentation/sysctl/kernel.txt
printk: The four values in printk denote: console_loglevel, default_message_loglevel, minimum_console_loglevel and default_console_loglevel respectively. These values influence printk() behavior when printing or logging error messages. See 'man 2 syslog' for more info on the different loglevels. - console_loglevel: messages with a higher priority than this will be printed to the console - default_message_level: messages without an explicit priority will be printed with this priority - minimum_console_loglevel: minimum (highest) value to which console_loglevel can be set - default_console_loglevel: default value for console_loglevel
Definitions of kernel logging numbers, from Syslog’s manual:
#define KERN_EMERG "<0>" /* system is unusable */ #define KERN_ALERT "<1>" /* action must be taken immediately */ #define KERN_CRIT "<2>" /* critical conditions */ #define KERN_ERR "<3>" /* error conditions */ #define KERN_WARNING "<4>" /* warning conditions */ #define KERN_NOTICE "<5>" /* normal but significant condition */ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */
Change kernel ring buffer logging level
Just keep in mind, using this approach only limits console logging and issuing dmesg would still print the over all logs.
# dmesg -n 3 or # dmesg -n 4
Raid tricks
Posted by Abbas in Uncategorized on December 16, 2009
Increasing the rebuild speed
Sometimes when you’re quite lazy or bored and don’t like the noticeable amount of free resources on your server, you may like to increase the raid building and resyncing process speed.
# echo 250000 > /proc/sys/dev/raid/speed_limit_max
# echo 250000 > /proc/sys/dev/raid/speed_limit_min
And this would spin up the hards faster to their maximum extent saving almost half of the time!
Defaults were:
# cat /proc/sys/dev/raid/speed_limit_max
200000
# cat /proc/sys/dev/raid/speed_limit_min
1000
And looks like my hards have 100M/s speed.
#hddtemp /dev/sda
/dev/sda: ST3750330AS: 31°C
# hdparm -t /dev/sda
/dev/sda:
Timing buffered disk reads: 280 MB in 3.01 seconds = 93.09 MB/sec
Checking and repairing
The larger the hard drive is the greater the probability of having its blocks corrupted. Its better to check for consistency against any bad blocks or md superblocks.
# cat /sys/block/md0/md/sync_action
idle
# echo check > /sys/block/md0/md/sync_action
And if there are any, repair them.
# echo repair > /sys/block/md0/md/sync_action
Setting up RAID alerts to send emails about any errors
Red Hat family distros come with built in service daemon mdmonitor which runs ‘mdadm –monitor’ in a daemon mode.
Remember to add “DEVICE partitions” or partitions being components of an md array to top of file /etc/mdadm.conf. Monitoring all RAID events and changing default email template Last edited on: Tue Mar 9 11:41:38 PST 2010
# mdadm --detail --scan >> /etc/mdadm.conf
# echo "MAILADDR some-email-address" >> /etc/mdadm.conf
# chkconfig mdmonitor on
# service mdmonitor restart
Added the two new tweaks.













Recent Comments