0% found this document useful (0 votes)
24 views3 pages

SSH Script

Download as txt, pdf, or txt
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 3

#!

/bin/bash

# Update the package list and install Apache


sudo apt-get update
sudo apt-get install -y apache2

# Get the VM's external IP address


VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Create a simple HTML page with the VM's IP address


echo "<html><body><h1>Welcome to My GCP VM and VM IP Address is: $VM_IP
</h1><p></p></body></html>" | sudo tee /var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start-----------------YES/Healthy-------------------Response
Capable----Traffic--Divert

#!/bin/bash

# Update the package list and install Apache


sudo apt-get update
sudo apt-get install -y apache2

# Get the VM's external IP address


VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Get the VM's private IP address


PRIVATE_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
ip)

# Get the VM's hostname


HOSTNAME=$(hostname)

# Create a simple HTML page with the VM's information


echo "<html><body><h1>Welcome to My GCP VM</h1><p>Hostname: $HOSTNAME</p><p>VM IP
Address: $VM_IP</p><p>Private IP: $PRIVATE_IP</p></body></html>" | sudo tee
/var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start

To increase CPU utilization on an Ubuntu system through SSH,


you can use various methods and tools to generate load on the CPU.

sudo apt-get install stress

You can control how long the stress test runs by specifying a duration using the --
timeout option.
For example, to run the stress test for 60 seconds, you can use:

stress --cpu 4 --timeout 900s //

While stress is running, you can monitor your system's CPU usage, memory, and
other performance metrics using tools like top, htop, or nmon to observe the
effects of the CPU stress test

top

yes > /dev/null &

#! /bin/bash
sudo apt-get update
sudo apt-get install apache2 -y
# Get the VM's external IP address
VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Create a simple HTML page with the VM's IP address


echo "<html><body><h1>Welcome to My GCP VM and VM IP Address is: $VM_IP
</h1><p></p></body></html>" | sudo tee /var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start

#! /bin/bash

# Update the package list and install Apache


sudo apt-get update
sudo apt-get install -y apache2

# Get the VM's external IP address


VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Create a simple HTML page with the VM's IP address


echo "<html><body><h1>This is Application-01 VM and VM IP Address is: $VM_IP
</h1><p></p></body></html>" | sudo tee /var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start

#! /bin/bash

# Update the package list and install Apache


sudo apt-get update
sudo apt-get install -y apache2

# Get the VM's external IP address


VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Create a simple HTML page with the VM's IP address


echo "<html><body><h1>This is Application-02 VM and VM IP Address is: $VM_IP
</h1><p></p></body></html>" | sudo tee /var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start

#! /bin/bash

# Update the package list and install Apache


sudo apt-get update
sudo apt-get install -y apache2

# Get the VM's external IP address


VM_IP=$(curl -s -H "Metadata-Flavor: Google"
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/
access-configs/0/external-ip)

# Create a simple HTML page with the VM's IP address


echo "<html><body><h1>This is Application-03 VM and VM IP Address is: $VM_IP
</h1><p></p></body></html>" | sudo tee /var/www/html/index.html

# Start the Apache service using the service command


sudo service apache2 start

A Network Engpoint Group (NEG) is Configuration Objects that specifies a Group of


Backend Endpoints or Services (NO AUTO_SCALING)
Types of NEG
Zonal NEG
Internet NEG
Serverless NEG
Hybrid Connectivity NEG
Private Service Connect NEG

You might also like