Welcome
My name is Ulysses. Sr. Cloud Engineer at Cardinal Health.
About This Website
This is my static site based on Hugo.
My name is Ulysses. Sr. Cloud Engineer at Cardinal Health.
This is my static site based on Hugo.
How to unmount CVS snapshot volumes all at once using a Bash script. I ran into a scenario where I had to unmount 115 volumes. Instead of manually running umount on each one, I use the script below to unmount all 115 volumes. The script performs a grep for ‘.snapshot’ and then writes the results to a file. I then read the file line by line and perform unmount on each one. ...
Here’s the script that looks mounts with stale file handles and removes them. #!/bin/bash file='/tmp/stale.txt' df -h | grep Stale > $file sed -i -e 's/df: ‘/'""'/g' $file sed -i -e 's/’: Stale file handle/'""'/g' $file while IFS= read -r line; do echo 'unmounting '$line umount $line done
Here’s how to copy a directory structure from one directory to another without the files. Copy directory structure of DIR1 to DIR2. find /DIR1 -type d > /tmp/dirs.txt sed -i 's/DIR1/DIR2/' /tmp/dirs.txt xargs mkdir -p
How to run editors from the Terminal. Sublime, Visual Studio Code, Atom and Bluefish examples. Open from the current directory. subl . code . atom . bluefish . Open editor using path and file. subl /etc/hosts code /etc/hosts atom /etc/hosts bluefish /etc/hosts
Here’s how to add breaks in your Bash scripts. The function is called 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 } spacebar You can call it multiple times in your script since it’s a function.
Here’s how to set Vim colors permanently. vi ~/.vimrc Add the following. highlight Normal ctermfg=white ctermbg=black
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 Output Starting upgrade Press spacebar to continue. Or Ctrl-C to exit. If you press spacebar it will continue. Ctrl-C exits the program.
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 ...
Check mounted file systems using df. Displaying different options. df df -h df -Th To get rid tmpfs, run this. df -Th| grep -Ev '(udev|tmpfs)'
Here’s how to extend an ext4 boot volume. gcloud compute disks resize DISK_NAME --size DISK_SIZE --zone ZONE --project PROJECTID Resize the file system. Example / is on sda3. growpart /dev/sda 3 resize2fs /dev/sda3