Here’s the command to check if instance is domain joined.
realm discover domain.com |
To check if AD user is working.
id user@ad.example.com |
To check if AD group is working.
getent group ad-group |
cloud engineer
by Ulysses ·
Here’s the command to check if instance is domain joined.
realm discover domain.com |
realm discover domain.com
To check if AD user is working.
id user@ad.example.com |
id user@ad.example.com
To check if AD group is working.
getent group ad-group |
getent group ad-group
by Ulysses ·
This is a Powershell script to restart a service if it’s down.
$ServiceName = 'GCEAgent' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -ne 'Running') { Start-Service $ServiceName write-host $arrService.status write-host 'Service starting' Start-Sleep -seconds 60 $arrService.Refresh() if ($arrService.Status -eq 'Running') { Write-Host 'GCE Agent Service is now Running' } } else { Write-Host 'GCE Agent Service is Running' } |
$ServiceName = 'GCEAgent' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -ne 'Running') { Start-Service $ServiceName write-host $arrService.status write-host 'Service starting' Start-Sleep -seconds 60 $arrService.Refresh() if ($arrService.Status -eq 'Running') { Write-Host 'GCE Agent Service is now Running' } } else { Write-Host 'GCE Agent Service is Running' }
by Ulysses ·
Here’s how to check if instances are running in GCP.
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" gcloud compute instances describe $instance \ --zone $zone --project $project \ --format='table[no-heading](name,status,zone)' done < instance-list.txt |
#!/bin/bash while IFS=', ' read -r a b c; do instance="${a//[[:blank:]]/}" project="${b//[[:blank:]]/}" zone="${c//[[:blank:]]/}" gcloud compute instances describe $instance \ --zone $zone --project $project \ --format='table[no-heading](name,status,zone)' done < instance-list.txt
Instances are read from an external file. File is comma delimited with instance name, project id and zone data.
by Ulysses ·
How to check which kernel is running on your system
uname -sr |
uname -sr
List all kernels installed on the system.
rpm -q kernel |
rpm -q kernel
Removing old kernels using package-cleanup. This keeps 2 kernels on the system.
yum install yum-utils package-cleanup --oldkernels --count=2 |
yum install yum-utils package-cleanup --oldkernels --count=2
by Ulysses ·
How to check RPM if packages are installed.
rpm -qa --last rpm -qa --last | more rpm -qa --last | grep "package name" |
rpm -qa --last rpm -qa --last | more rpm -qa --last | grep "package name"
by Ulysses ·
Here are several commands to check memory in Linux.
free -m cat /proc/meminfo vmstat -s top |
free -m cat /proc/meminfo vmstat -s top
by Ulysses ·
How to check for an argument in a script in Bash.
if [ -z "$1" ] ; then echo "there are no arguments" else echo "there is an argument" fi |
if [ -z "$1" ] ; then echo "there are no arguments" else echo "there is an argument" fi