Posts

pythonscript

if you want to send email if / is more than 20% then it will send it in python  server1:/ #cat t44.py #!/usr/bin/python3 import os import datetime import subprocess data=os.popen("df -gt").readlines() for line in data:     sp_line=line.split()     if sp_line[-1]=='/':         x=int(float(sp_line[-2].rstrip('%')))         if x>20:             print('test')             cmd='echo "Hello Team capacity is greater then 20%" | mailx -s "Monitor" jatin_sethi@optum.com'             subprocess.run(cmd, shell=True)

GIT - 4

Image
 how to commit, push & pull from github ======================================= ->login into mumbai EC2 instance -> create one directory and go inside it -> git init -> touch myfile (put some data) -> git status -> git add .   (like adding a file in staging area) -> git commit -m "1st commit from mumbai" (like adding a file in local repo) -> git status -> git log -> git show <commit-id> -> git remote add origin <centralgit url> -> git push -u Origin master (enter username and password) Recently There is having a change in accessing the github. Recently github have started token system for transferring files. Need to login github >> Settings >> Developer settings >> Personal Access Tokens >> Generate new token >> Give the name for the token and select the repo in the scope.... After the token is generated copy the code in the notepad. Therefore while PUSH and PULL to and from ORIGIN you require t

GIT - 5

  How to create Branch, Merge & Stash ============================================  _____0 branch (little branch) |(start) 0--------------0------0---------------0 (master) master      commit   commit    |                                |_______0______0_____0(big features) The diagram above visualizes a Repository with two isolated lines of development, one for a little features, and one for a longer-running features. By developing them is Branches, it's not only possible to work on both of them in parallel but it also keeps the main master branch free from error. -> Each task has one separate branch. -> After done with code, Merge other branches with master. -> This concept is useful for parallel developments. -> you can create any no. of branches. -> changes are personal to that particular branch. -> default branch is 'Master' -> files created in Workspace will be visible in any of the branch workspace untill you commit. Once you commit, then that

GIT - 3

 How to use git and create github account ========================================= AWS account-> create two EC2 instance (Linux) allow ssh and http port in security group. on first machine. ================ -> sudo su  -> yum upate -y -> yum install git -y -> git --version  or which git -> git config --global user.name "bhupinder" -> git config --global user.email "bhupinder@gmail.com" -> git config --list on second machine ================= -> sudo su  -> yum upate -y -> yum install git -y -> git --version  or which git -> git config --global user.name "Ajay" -> git config --global user.email "Ajay@gmail.com" -> git config --list

GIT - 2

 Stages of GIT and its terminology ================================== Git is DVCS. It is created by linus. It is software. Github is a service. it is not git. It is like storage  Gitlab is a service. it is not git. It is like storage  stage of GIT/workflow ----------------------- 1. Workspace/working directory 2. Staging area 3. Local Repo Repository: ========== -> Repository is a place where you have all your codes or kind of folder on server. -> It is a kind of folder related to one product. -> Changes are personal to that particular Repository. Server: ====== -> It stores all Repositories. -> It contains metadata also. Working Directory: ================= -> Where you see files physically and do modification. -> At a time, you can work on particular branch. In other CVCS, develpers generally makes modificatons and commit there changes directly to the repository but git uses a different strategy. Git does not track each and every modified file whenever you do com

GIT - 1

 Introduction of GIT ==================== software configuration management   or source code management a) Centralised version control system b) Distributed version control system CVCS ---- drawbacks: --------- 1) It is not locally available, meaning you always need to be connected to a network to perform any action. 2) since everything is centralised, if central server gets failed, you will lose entire data. Eg- SVN tool. DVCS ---- In distributed version control system, every contributor has a local copy or 'clone' of the main repository. I.e. everyone maintains a local repository of their own which contains all the files and metadata present is Main repository. Difference between CVCS and DVCS CVCS ----- 1) In Cvcs, a client need to get local copy of source from server, do the changes and commit those changes to central source of server. 2) CVCS  system are easy to learn and setup. 3) working on braches is difficult in cvcs developer often  faces merge conflict. 4) C

Docker interview questions

 Q1 what is docker? ans it is mechanism which is used to create containers. containers are isolated environment to run your application. Q what is the advantage of Docker over hypervisors?  Docker containers use docker-engine instead of the hypervisor, like in virtual machines. As the host kernel in not shared, using docker-engine makes containers small, isolated, compatible, high performance-intensive and quickly responsive. Q what is docker images? Ans it is snapshot of base image. It combination of code and base machine library files. it does not have stages like running or stop, exit and paused Q what is docker container? ans it is running instance of docker image. it does have stages like running and stop, exit, paused. Q what is docker hub? ans it is registary where you can download mulitple images.  Q how to create docker container? docker run -it image shell Q how many container can run per host? there is no such limit. it is totally depend on hardware capability. Q is containe