• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for April 2021

IPinfo.io Map

April 24, 2021

Generate a map of your live streaming viewers by placing of your viewer’s IP into a file and then using IPInfo’s map tool.

vim ipList
54.0.0.1
54.0.0.2
54.0.0.3

vim ipList 54.0.0.1 54.0.0.2 54.0.0.3

To plot the IPs on a map, pipe them to IPinfo.io.

cat ipList | curl -XPOST --data-binary @- "ipinfo.io/map?cli=1"

cat ipList | curl -XPOST --data-binary @- "ipinfo.io/map?cli=1"

The result is a URL of the map.

Filed Under: Linux Tagged With: generate, ipinfo.io, map, plot

Ubuntu Speedtest

April 18, 2021

Install Speedtest CLI.

sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo "deb https://ookla.bintray.com/debian generic main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
sudo apt-get install speedtest

sudo apt-get install gnupg1 apt-transport-https dirmngr export INSTALL_KEY=379CE192D401AB61 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY echo "deb https://ookla.bintray.com/debian generic main" | sudo tee /etc/apt/sources.list.d/speedtest.list sudo apt-get update sudo apt-get install speedtest

To run.

speedtest

speedtest

Result.

$ speedtest
   Speedtest by Ookla
     Server: City of Columbus - Columbus, OH (id = 40410)
        ISP: Spectrum
    Latency:     9.39 ms   (0.63 ms jitter)
   Download:   117.74 Mbps (data used: 60.3 MB)                               
     Upload:    11.81 Mbps (data used: 5.6 MB)                               
Packet Loss:     0.0%
 Result URL: https://www.speedtest.net/result/c/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx (redacted)

$ speedtest Speedtest by Ookla Server: City of Columbus - Columbus, OH (id = 40410) ISP: Spectrum Latency: 9.39 ms (0.63 ms jitter) Download: 117.74 Mbps (data used: 60.3 MB) Upload: 11.81 Mbps (data used: 5.6 MB) Packet Loss: 0.0% Result URL: https://www.speedtest.net/result/c/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx (redacted)

Filed Under: Linux Tagged With: apt, speedtest, ubuntu

Invalid Credentials with gsutil

April 16, 2021

If you’re trying to access GCS (Google Cloud Storage) and you’re getting “Your credentials are invalid. Please run gcloud auth login”, you most likely have a previous key stored in the ~/.boto file. This happens if you previously configured gsutil with your own credentials, then switched over to Google SDK mode. To fix the invalid credentials, edit the ~/.boto file and comment out the auth key.

vim ~/.boto

vim ~/.boto

Comment out.

#gs_oauth2_refresh_token = <token redacted>

#gs_oauth2_refresh_token = <token redacted>

Rerun the gsutil ls command. It should work.

Filed Under: Cloud Tagged With: .boto, auth, gcp, invalid, login, service account, token

Sosreport

April 16, 2021

Install

yum install sos

yum install sos

Run sosreport

sosreport

sosreport

Case number will be part of exported report located in /var/tmp.

cd /var/tmp

cd /var/tmp

Filed Under: Linux Tagged With: report, sosreport, troubleshoot

WordPress Critical Error

April 11, 2021

If you get a WordPress “There has been a critical error on your website” error, you probably have an issue with a theme or plugin. The quickest way to troubleshoot is to rename the plugins directory since there’s no way to login. This technically disables all plugins. Rename it back to plugins and enable each plugin one by one.

Disable all plugins.

mv plugins plugins-backup

mv plugins plugins-backup

Login and restore the plugins directory.

mv plugins-backup plugins

mv plugins-backup plugins

Enable each plugin one by one and check if the site is broken.

Filed Under: WP Tagged With: critical, error, plugins, themes

Docker Exec

April 9, 2021

If you want to SSH to a Docker container, use the Docker exec command.

docker exec -it container_name bash

docker exec -it container_name bash

I’m using a Git Bash terminal, so I have to prefix the docker command with winpty.

winpty docker exec -it container_name bash

winpty docker exec -it container_name bash

Result

root@681bbe3f65f1:/var/www/html#

root@681bbe3f65f1:/var/www/html#

Ctrl-D to exit.

Filed Under: Linux Tagged With: bash, container, docker, exec, git bash

Troubleshoot Nameservers with Dig

April 8, 2021

Here’s how to troubleshoot nameservers with dig.

dig hostname
dig domain.com

dig hostname dig domain.com

To test a specific nameserver.

dig @nameserver hostname
dig @nameserver ip-address

dig @nameserver hostname dig @nameserver ip-address

Other options.

dig hostname.domain.com +short
dig hostname.domain.com +noall +answer
dig @nameserver MX domain.com
dig @nameserver AAAA domain.com

dig hostname.domain.com +short dig hostname.domain.com +noall +answer dig @nameserver MX domain.com dig @nameserver AAAA domain.com

Filed Under: Linux Tagged With: dig, nameservers, test, troubleshoot

Startup Script

April 6, 2021

Here’s how to run a script on bootup on Rhel 7 that’s running systemd.

First create a script. It this case, it will create a file called test.txt.

#!/bin/bash
> /root/test.txt

#!/bin/bash > /root/test.txt

Make the script executable.

chmod /root/test.sh

chmod /root/test.sh

Now create a service in /etc/systemd/system/test.service

# vi /etc/systemd/system/test.service
[Unit]
Description=A test service
After=network.target
[Service]
Type=simple
ExecStart=/root/test.sh
TimeoutStartSec=0
[Install]
WantedBy=default.target

# vi /etc/systemd/system/test.service [Unit] Description=A test service After=network.target [Service] Type=simple ExecStart=/root/test.sh TimeoutStartSec=0 [Install] WantedBy=default.target

Reload systemd.

systemctl daemon-reload

systemctl daemon-reload

Enable the service.

systemctl enable test.service

systemctl enable test.service

Start the service.

systemctl start test.service

systemctl start test.service

Reboot and test.

reboot

reboot

Validate if the script ran. Check if the file was created.

Filed Under: Cloud, Linux Tagged With: bootup, rhel 7, script, systemd

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023