diff --git a/bash/backup-status b/bash/backup-status new file mode 100644 index 0000000..60e94e2 --- /dev/null +++ b/bash/backup-status @@ -0,0 +1,10 @@ +#!/bin/bash + +# /usr/local/bin/ +# backup-status by htrigg +# +# Displays the mounted media disks and the backup directories + +tput setaf 2;df -h | awk '$6 ~ "media"' +tput sgr0;ls -ltr --color=auto /media/corin/BACKUP + diff --git a/bash/copy_keyfile b/bash/copy_keyfile new file mode 100644 index 0000000..df1461d --- /dev/null +++ b/bash/copy_keyfile @@ -0,0 +1,26 @@ +#!/bin/bash +#/usr/local/bin/copy_keyfile +# Copy over the encryption key and mount the external drive + +# Try to copy over the encryption key. Give up after three minutes. +for attempt in $(seq 1 6); do + # Attempt to copy the file + if scp unraid@192.168.10.204:keyfile /dev/shm/keyfile; then + # Exit the loop on success + break + else + # Wait before retrying + sleep 30 + fi +done + +# Check if the loop completed successfully +if [ $? -ne 0 ]; then + echo "Failed to copy the encryption key after multiple attempts." >&2 + exit 1 # Exit with failure code 1 +fi + +# Mount the drive +cryptsetup --key-file /dev/shm/keyfile luksOpen /dev/sdb1 corin +mount /dev/mapper/corin /media/corin + diff --git a/bash/remount-all b/bash/remount-all new file mode 100644 index 0000000..5d9afed --- /dev/null +++ b/bash/remount-all @@ -0,0 +1,20 @@ +#!/bin/bash + +# /usr/local/bin/ +# remount-all by htrigg +# +# mount and decrypt all drives after a power outage +# +# v1.0 released 05/01/2020 +# v2.0 released 02/06/2022 +# v3.0 released 10/03/2025 - moved to sdb1 + +echo "Mounting Coriakin..." +mount /media/coriakin +echo "Opening the crypt..." +cryptsetup luksOpen /dev/sdb1 corin +echo "Mounting Corin..." +mount /dev/mapper/corin /media/corin +df -h | awk '$6 ~ "media"' +ls -latr /media/corin/BACKUP + diff --git a/bash/remove-corin b/bash/remove-corin new file mode 100644 index 0000000..668475f --- /dev/null +++ b/bash/remove-corin @@ -0,0 +1,20 @@ +#!/bin/bash + +# /usr/local/bin/ +# remove-corin by htrigg +# +# unmount and secure data +# run using 'sudo remove-corin' +# +# v1.0 released 0/01/2020 + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi +echo "Unmounting Corin..." +umount /media/corin +echo "Closing the crypt..." +cryptsetup luksClose corin +