Skip to content

Instantly share code, notes, and snippets.

View mansurali901's full-sized avatar

Mansur Ul Hasan mansurali901

View GitHub Profile
@mansurali901
mansurali901 / KubernetesSetupUbuntu.sh
Last active December 25, 2020 02:29
This script is meant to setup Kubernetes Environment on Ubuntu / Debian supported paltforms
#!/bin/bash
# Maintainer : Mansur Ul Hasan
# EMail : [email protected]
# LinkedIn : https://www.linkedin.com/in/mansurulhasan/
# Youtube : https://www.youtube.com/user/mansur7820/
# This script is meant to setup Kubernetes Environment on Ubuntu / Debian supported paltforms
# We have try to cover all the required tools modules which needed by modern kubernetes
# Disclaimer :
# This script is well tested on ubuntu 18 and 16
#!/bin/bash
arg=$@
if [ $# -le '2' ];
then
echo "Script has sufficient parameter"
else
echo "Invalid parameter"
fi
#!/bin/bash
MONGOD=`ps aux |grep mongod |grep -v grep |awk '{print $2}'`
MONGOCOUNT=`ps aux |grep mongod |grep -v grep |awk '{print $2}'|wc -l`
mail_func () {
echo $MONGOD > /tmp/email
mail -s "Mongo is not running " [email protected] < /tmp/email
}
#!/bin/bash
GoMongo () {
echo "Mongo is going to start"
mongod --config /etc/mongod.conf
echo "mongo is started"
}
StopMongo () {
#!/bin/bash
# Get current swap usage for all running processes
# Mansur Ul Hasan 04/02/2017
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
do
@mansurali901
mansurali901 / InstallHAProxy_ubuntu.sh
Created May 8, 2019 08:28
This script will automate process for HAProxy installation
#!/bin/bash
# This script will install HAproxy with LUA+SSL support
# Author : Mansur Ul Hasan
# Email : [email protected]
# Disclaimer : This script is well tested on ubuntu if you are using RPM based distros please install relevant packages
CheckOS () {
@mansurali901
mansurali901 / main_ec2_complete_setup.tf
Last active June 7, 2019 13:52
This script setup whole infrastructure on AWS to run ec2 instance this will include VPC Setup (Including : "VPC", "Subnet", "internet Gateway", "Route Table", "Security Group to allow SSH") also it sets up EC2 Instance along with keypairs
##############################
# This script setup whole infrastructure on AWS to run ec2 instance this will include VPC Setup
# (Including : "VPC", "Subnet", "internet Gateway", "Route Table", "Security Group to allow SSH")
# also it sets up EC2 Instance along with keypairs
##############################
### Provider Setup
provider "aws" {
region = "us-east-2"
}
### Variables declearation
@mansurali901
mansurali901 / statefull_nginx.tf
Last active August 22, 2019 13:05
This script consist with State Full Web Server with Nginx using terraform
############################################################################
# Author Mansur Ul Hasan
# EMail : [email protected]
# YouTube : https://www.youtube.com/user/mansur7820/about?view_as=subscriber
# This script consist with State Full Web Server with Nginx using terraform
# This script will setup
# - VPC
# - Subnets
# - Route Tables
@mansurali901
mansurali901 / Nginx_Compile.sh
Last active June 21, 2019 16:26
Your Nginx Compilation made easy with this script
#!/bin/bash
# Author : Mansur Ul Hasan
# EMail : [email protected]
# Disclaimer :
# This script is well tested on Ubuntu Docker image and latest Ubuntu version along with
# some older versions like Ubuntu 14.04
SetupLoc='/tmp'
Download_Setup () {
# This function download all neccesary files which are required
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.99-1.el7_6.noarch.rpm
yum install docker-ce
systemctl status docker.service && systemctl enable docker.service && systemctl start docker.service && systemctl status docker.service