Category Archives: Server-side Scripting.

Server-side Scripting.

Block ip address using iptables

How to block ip address using iptables Some times we need to block ip address of spammer using iptables when Akismet plugin and recaptcha sometimes doesn’t work for manual spamming. Following example shows how to filter IN and OUT traffic … Continue reading

Posted in Hardware and Networking, Protocals, Proxy, Shell Script | Tagged , | Leave a comment

Best Java tools for profiling

Best Java tools : Recently, I was building real-time, high performance back-end Java application which computes 16K ratios per company for around 70K companies (~1.1bn total) by pulling data from different data sources like, Mongodb, Cassandra, Mysql and Redis. It … Continue reading

Posted in Java | Tagged | Leave a comment

How to setup cassandra on Ubuntu 14.04

What is Cassandra? The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data.Cassandra’s … Continue reading

Posted in Cassandra, Php, Uncategorized | Tagged | Leave a comment

Killing child process in shell script

Killing child process in shell script: Many time we need to kill child process which are hanged or block for some reason. eg. FTP connection issue. There are two approaches, 1) To create separate new parent for each child which … Continue reading

Posted in Shell Script | Tagged | Leave a comment

Setup solr using zookeeper ensemble on ubnutu

Setup Oracle Java: Follow quick step given below to setup java latest version on your system, java -version tar -zxvf jdk-8u45-linux-x64.tar.gz sudo mkdir -p /usr/lib/jvm/jdk1.8.0_45 sudo mv jdk1.8.0_45/* /usr/lib/jvm/jdk1.8.0_45/ sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.8.0_45/bin/java” 1 sudo update-alternatives –install “/usr/bin/javac” … Continue reading

Posted in Java, Solr, Zookeeper | Tagged , , , | Leave a comment

PHP multiprocessing using fork

PHP multiprocessing using fork: Process Control support in PHP implements the Unix style of process creation, program execution, signal handling and process termination. Find more details at PHP fork The pcntl_fork() function creates a child process that differs from the … Continue reading

Posted in Php | Leave a comment

Shell script multi-processing

Shell script multi processing : Multi processing using shell script can be achieve by spawning multiple child processes. There are two method , 1) Using commands as string : #!/bin/bash declare -a NOS=(1 2 3 5 6 7 8); STR=”{ … Continue reading

Posted in Shell Script | Tagged | Leave a comment

Install erlang on ubuntu

Install erlang on ubuntu : Remove older erlang if any : #sudo apt-get remove erlang #sudo apt-get autoremove erlang #sudo apt-get purge erlang Installation using repository : #sudo apt-get install erlang erlang-doc Manual Installation using repository : Download Erlang 1. … Continue reading

Posted in Erlang | Tagged , | Leave a comment

Git deployment shell script

Git deployment shell script Following shell script can be useful for deplying git branch on multiple servers. #!/bin/bash DIR=”$( cd “$( dirname “${BASH_SOURCE[0]}” )” && pwd )” HN=$(hostname) declare -A SERVER; SERVER["app1"]=”ubuntu@″; SERVER["app12"]=”ubuntu@″; SERVER["mongo1"]=”ubuntu@333.333.333.33″; SERVER["mongo12"]=”ubuntu@333.333.333.33″; SERVER["lb1"]=”ubuntu@444.444.444.44″; SERVER["lb12"]=”ubuntu@555.555.555.55″; usage() { local … Continue reading

Posted in Revision control, Shell Script | Tagged , | Leave a comment

Configuration Deployment script

Configuration Deployment script : Following configuration deployment script can be use to deploy git ignored configuration files on multiple server. #!/bin/bash set -e DIR=$(pwd); HST_NAM=$(hostname); CNF_FLR=$DIR”/configs”; KOH_CNF_FIL=”environment.php”; SYM_CNF_FIL=”parameters.yml”; KOH_SER_CNF_PHT=”/var/www/frontend/application/config/”; KOH_STG_SER_CNF_PHT=”/var/www/frontendstaging/application/config/”; SYM_SER_CNF_PHT=”/var/www/backend/Symfony/app/config/”; SYM_STG_SER_CNF_PHT=”/var/www/backendstaging/Symfony/app/config/”; SYM_STG_APP_SER_CNF_PHT=”/var/www/backendappstaging/Symfony/app/config/”; FLAG=”d”; HIP_CHAT_MEG=”"; SEP=”"; usage() { local COMMAND_COLOR=”\033[32m”; … Continue reading

Posted in Shell Script | Tagged | Leave a comment