Parse query string in shell script

Sometimes we have to integrate multiple languages like node.js/php/shell script into bash shell script and parse query string to array for supplying query string data for manipulation. Here is the simple script which will help you to achieve that goal: #!/usr/bin/env bash declare -A querydict populate_querystring_array () { query=”$1″ while IFS== read arg value do […]

No package ‘opencv’ found

If you are getting this error while compiling certain modules which requires opencv library which is causing the execution to be aborted. For fixing it, you need to install lib-opencv using following command: Ubunntu/Debian – sudo apt-get install libopencv-dev Centos/Red Hat – sudo yum install opencv-devel After you do so, pkg-config –cflags opencv and pkg-config –libs opencv will work […]

How to configure libstdc++ with GCC 4.8?

You need to tell your dynamic linker (it’s executed when you run your program) where to find the library. Set LD_LIBRARY_PATH to the path of the library (probably somewhere under /app/gcc/4.8.0/lib or something). Use find /app/gcc/4.8.0 -name “libstdc++.so.6”. Add the directory to your LD_LIBRARY_PATH. e.g with the path I mentioned: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/gcc/4.8.0/lib (if you’re using […]

What is configure, make, make install ?

There are lot of confusions for usual configure, make, make install sequence to get a program running in Linux. Unfortunately, most developers today have never used a compiler to install an application and used the GUI application builders. The make utility is designed to decrease a programmer’s need to remember line of commands. I guess […]

Remove Double Extensions in Linux

  Following script will help you to remove double extensions which can be added by some programs or by user mistakes and need to be corrected in bulk. Here is the solution, You have to perform this in the current working directory (non-recursively). vim fix_extension.sh Content of fix_extension.sh #!/bin/bash echo “Existing Extension” $1 echo “Converted Extension” […]

Check Application Memory usage using simple command

To check the total amount of memory used by any program’s child processes: Create a shell script # vim checkmem.sh Contents: echo “————————————-Memory Checkup————————————“; ps -ylC $1 –sort:rss | awk ‘!/RSS/ { s+=$8 } END { printf “%s\n”, “Total memory used by child processes: “; printf “%dM\n”, s/1024 }’ Run Script with a argument whose […]

Setup Pure-FTPd Daemon in Linux

Install Pure-FTPd In a Linux shell run the following: Ubuntu – apt-get install pure-ftpd-common pure-ftpd Red Hat, Centos- yum install pure-ftpd-common pure-ftpd Now we need to create a new system group for pureftpd: groupadd ftpgroup Now we add a user for the group and give that user no permission to a home directory or a […]

Adding a Cron Job in Magento

Add the following lines to your module’s config.xml file under etc folder. <crontab> <jobs>             <namespace_yourmodulename>                 <schedule><cron_expr>*/1 * * * *</cron_expr></schedule> <run><model>navision/observer::methodToCall</model></run> </namespace_yourmodulename> </jobs> </crontab>   Observer: <?php class Namespace_Yourmodulename_Model_Observer { public static function methodToCall(){ //Code to Execute Mage::log(“Cron Executed”); } } ?> Note: Magento root file cron.php needs to be added to crontab […]