cleanup cvs snapshot volumes

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. ...

August 30, 2022 · 1 min · ulysses

cleanup stale cvs snapshots

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

August 30, 2022 · 1 min · ulysses

copy directory structure

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

August 25, 2022 · 1 min · ulysses

editors on terminal

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

August 25, 2022 · 1 min · ulysses

bash spacebar break

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.

August 16, 2022 · 1 min · ulysses

set vim colors permanently

Here’s how to set Vim colors permanently. vi ~/.vimrc Add the following. highlight Normal ctermfg=white ctermbg=black

August 12, 2022 · 1 min · ulysses

press spacebar to continue

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.

August 5, 2022 · 1 min · ulysses

bare metal servers

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 ...

August 4, 2022 · 1 min · ulysses

check mounted file systems

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)'

July 28, 2022 · 1 min · ulysses

gcp extend ext4 boot volume

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

July 28, 2022 · 1 min · ulysses