• Skip to main content

Uly.me

cloud engineer

  • Home
  • Archives
  • Search

Press spacebar to continue

August 5, 2022 by Ulysses

Here’s a little snippet of Bash code that waits for spacebar to be pressed to continue.

function spacebar {
  echo 'Press spacebar to continue. Press Ctrl-C to exit.'
  stty -echo > /dev/null
  until read -r -n 1 -t 0.001 && [ "$REPLY" = ' ' ]; do abc=''; done
  stty echo > /dev/null
}
echo 'Starting upgrade'
spacebar

function spacebar { echo 'Press spacebar to continue. Press Ctrl-C to exit.' stty -echo > /dev/null until read -r -n 1 -t 0.001 && [ "$REPLY" = ' ' ]; do abc=''; done stty echo > /dev/null } echo 'Starting upgrade' spacebar

Output

Starting upgrade
Press spacebar to continue. Or Ctrl-C to exit.

Starting upgrade Press spacebar to continue. Or Ctrl-C to exit.

If you press spacebar it will continue. Ctrl-C exits the program.

Filed Under: Linux Tagged With: bash, continue, spacebar, wait

Bare Metal Servers

August 4, 2022 by Ulysses

Why would you choose Bare Metal Servers?

Advantages

– BMS are dedicated to a single organization
– Single tenant or dedicated host
– No sharing of hardware, storage, connection, bandwidth (noisy neighbor)
– There is no hypervisor layer
– No virtualization overhead
– OS is loaded straight to the server
– Results in higher performance
– Quality of hardware
– Compliance and security due to single tenant
– Flexible contract, billing options

Disadvantages

– Procurement could take weeks depending on hardware type
– And that goes for replacement hardware as well.

Filed Under: Cloud Tagged With: advantages, bare, bms, disadvantages, metal, servers

Check Mounted File Systems

July 28, 2022 by Ulysses

Check mounted file systems using df. Displaying different options.

df 
df -h
df -Th

df df -h df -Th

To get rid tmpfs, run this.

df -Th| grep -Ev '(udev|tmpfs)'

df -Th| grep -Ev '(udev|tmpfs)'

Filed Under: Linux Tagged With: check, df, file, mounts, systems, tmpfs

GCP Extend ext4 Boot Volume

July 28, 2022 by Ulysses

Here’s how to extend an ext4 boot volume.

gcloud compute disks resize DISK_NAME --size DISK_SIZE

gcloud compute disks resize DISK_NAME --size DISK_SIZE

Resize the file system. Example / is on sda3.

growpart /dev/sda 3
resize2fs /dev/sda3

growpart /dev/sda 3 resize2fs /dev/sda3

Filed Under: Cloud, Linux Tagged With: boot, ext4, extend, gcloud, gcp, growpart, resize2fs, volume

AWS Get Access Key Info

June 28, 2022 by Ulysses

How to look for an access key in AWS. Find the account.

$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX
{
    "Account": "XXXXXXXXXXXX"
}

$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX { "Account": "XXXXXXXXXXXX" }

Filed Under: Cloud Tagged With: access, account, aws, get, key

GCP Create Service Account via Terraform

June 27, 2022 by Ulysses

How to create service account in GCP via Terraform.

provider "google" {
  project = "your_project_id"
}
resource "google_service_account" "service_account" {
  account_id   = "your-service-account-name"
  display_name = "test service account built by terraform"
}

provider "google" { project = "your_project_id" } resource "google_service_account" "service_account" { account_id = "your-service-account-name" display_name = "test service account built by terraform" }

Filed Under: Cloud Tagged With: create, gcp, service account, terraform

Calculate Date to Epoch Time

June 24, 2022 by Ulysses

Here’s a script to convert date to epoch time on Mac OS.

#!/bin/bash
if [[ -z $1 ]]; then
  echo "Format: date2epoch.sh 2022/01/01-04:58:06"
else
  echo "$1"; date -j -f date -j -f "%Y/%m/%d-%T" "$1" +"%s"
fi

#!/bin/bash if [[ -z $1 ]]; then echo "Format: date2epoch.sh 2022/01/01-04:58:06" else echo "$1"; date -j -f date -j -f "%Y/%m/%d-%T" "$1" +"%s" fi

Result

$ ./date2epoch.sh 2022/08/31-22:00:00
2022/08/31-22:00:00
1661997600

$ ./date2epoch.sh 2022/08/31-22:00:00 2022/08/31-22:00:00 1661997600

Filed Under: Linux Tagged With: conversion, date, epoch

GCP CloudShell via Terminal

June 20, 2022 by Ulysses

Connect to your CloudShell environment from your terminal.

$ gcloud cloud-shell ssh
Welcome to Cloud Shell! Type "help" to get started.
first.last@cloudshell $
first.last@cloudshell $

$ gcloud cloud-shell ssh Welcome to Cloud Shell! Type "help" to get started. first.last@cloudshell $ first.last@cloudshell $

Once logged in, you can set your project.

first.last@cloudshell $ gcloud config set project $PROJECT_ID

first.last@cloudshell $ gcloud config set project $PROJECT_ID

Filed Under: Cloud Tagged With: cloud shell, connect, gcp, terminal

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 119
  • Go to Next Page »
  • Home
  • About
  • Contact

Copyright © 2022