Renaborges.com

Browsing Archive: July, 2023

Discovering Docker & Kubernetes - Work in Progress (WIP)

Posted by Reny Borges on Friday, July 21, 2023, In : Containers 

·       About Docker

·       Namespaces

·       Control Groups

·       Container Image

·       Container Runtimes

·       Container Orchestration

·       Kubernetes Cluster

·       Kubernetes Main Resources (Pods, Services, Replication Controllers, Persistent Volume, Persistent Volume Claims)

·       Docker Commands

·       Docker Client Verbs

·       Managing Containers

Docker uses a client-server architecture, described below:    

                                 Client                      ...


Continue reading ...
 

Ping from a script

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

Method: We can write our own script using the ping command to query list of IP addresses and check whether they are alive or not as follows:

 

#!/bin/bash

#Filename: ping.sh

# Change base address 192.168.0 according to your network.

 

for ip in 192.168.0.{1..255} ;

do
       #Amount of packets transmitted "-c 2"
       #/dev/null is a virtual file. This will discard anything written to it.

ping $ip -c 2 &> /dev/null ;

if [ $? -eq 0 ];

then

echo $ip is alive

fi

done

 

...
Continue reading ...
 

Git main commands

Posted by Renata Shaw on Monday, July 3, 2023,

Git status

Git add .      (this adds everything or choose specific file to be added)

Git commit -m "my message"

Git push

Enter passphrase for key '/c/Users/rxxxxxxx/.ssh/id_rsa':



Continue reading ...
 

For Machines Without Telnet Installed

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

cat < /dev/tcp/IP/PORT

cat < /dev/tcp/192.90.70.200/3306

OR

curl -v telnet://ip:port'

curl -v telnet://192.90.70.200:3306

curl -v telnet://192.90.70.2001:3306



Continue reading ...
 

Helper Script

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

#!/bin/bash

 

echo "----------------------------"

echo "Sourcing Functions:"

echo "----------------------------"

echo " - nodes_up: Checks what hosts are up or down using nmap"

echo " - slbs_status: Check if NGINX Process and Status in AZ1 & AZ2"

echo " - slbs: Check if NGINX nodes are up / down using nmap in AZ1 & AZ2"

echo " - service_db_netwk: Checks connectivity between the Service in AZ1 and MySQL in AZ2 and vice-versa"

echo " - tail_service_log: Tail 100 lines of the service.lo...


Continue reading ...
 

IF statements arguments / flags / options / operation

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

Test operators

-e file exists

-f file exists and is not a directory

-s file is not empty

-d directory exists

-x file is executable (for the user running the test)

-r file is readable (for the user running the test)

-w file has write permission (for user running the test)

-h / -L file is a symbolic link

! "not"

 

Compound Comparison

-a logical 'and' similar to &&

-o logical 'or' similar to ||

 

Integer Comparison

-eq is equal to

-ne is not equal to

-gt or > is greater t...


Continue reading ...
 

Learning awk

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

Print column 1 & 2

ps | awk '{print $1,$2}'


To separate the columns titles you can use "\t" between the numbers:

ps | awk '{print $1"\t"$2}'


By default the field separator for awk is a space, if it's not the case tell awk which one it is by using F for field separator. In the example of /etc/passwd file the separator is semi-colon

awk -F ":" '{print $1}' /etc/passwd

You can also grep:

awk -F ":" '{print $1}' /etc/passwd | grep myservice

 

To search for every last field in the line, but r...


Continue reading ...
 

Learning sed

Posted by Renata Shaw on Monday, July 3, 2023, In : Linux 

sed > Stream editor allow filter and transform texts, find pattern and replace with whatever is that you want to replace with, it's like search and replace.

You can use other separators instead of slashes (/). Example pipe | or hash #

1 - sed substitution -- s for substitution. replaces only the first occurrence in each line of the file and save to a new file

sed 's/word/newword/' < oldfile > newfile

 

2 - replaces every occurrence of 'word'. g for global

sed 's/word/newword/g' < oldfi...


Continue reading ...
 
 
blog comments powered by Disqus
blog comments powered by Disqus