Removing old scripts, renaming and cleaning up
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script to export the Bit Frigger's rootfs to a zstd tarball periodically
|
||||
FINAL_DIR="/Red-Vol/Backups/Bit-Frigger/Tarball"
|
||||
#Check for root permissions
|
||||
if [[ $(whoami) != "root" ]]; then
|
||||
echo "Please run this script as root or with sudo."
|
||||
exit
|
||||
fi
|
||||
#Create directory if it does not exist
|
||||
if [[ ! -d $FINAL_DIR ]]; then
|
||||
echo "Destination directory $FINAL_DIR does not exist. Creating..."
|
||||
mkdir $FINAL_DIR
|
||||
echo "Changing ownership to shmick."
|
||||
chown -r shmick:shmick $FINAL_DIR
|
||||
else
|
||||
echo "Destination directory exists."
|
||||
fi
|
||||
#Sync everything to it
|
||||
echo "Gathering files for the tarball"
|
||||
rsync -aHAXSv --progress --exclude=/dev --exclude=/Red-Vol --exclude=/proc --exclude=/rksmb --exclude=/sys --exclude="/.snapshots" --exclude="/run" --exclude="/tmp" "/" "$FINAL_DIR"
|
||||
#And tar it with ZSTD
|
||||
echo "Compressing tarball"
|
||||
cd $FINAL_DIR
|
||||
echo "Working in directory $(pwd)"
|
||||
if [[ -f "$FINAL_DIR/Bit-Frigger.tar" ]]; then
|
||||
tar rvf Bit-Frigger.tar $(pwd) && echo "Running xz..." && xz -vv -z --threads=0 -9 Bit-Frigger.tar --memlimit=$(free -h | grep -v Swap | grep -v total | awk '{print $NF}')
|
||||
|
||||
else
|
||||
tar cvf Bit-Frigger.tar $(pwd) && echo "Running xz..." && xz -vv -z --threads=0 -9 Bit-Frigger.tar --memlimit=$(free -h | grep -v Swap | grep -v total | awk '{print $NF}')
|
||||
fi
|
||||
11
GitDaemon
11
GitDaemon
@@ -1,11 +0,0 @@
|
||||
#small script to be appended to bash.profile; calls the GitUpstreamer script to auto-commit changes
|
||||
function cd {
|
||||
# Actually change the directory with all args passed to the function
|
||||
if builtin cd "$@"; then
|
||||
# If the dir exists, run the git script on git directories
|
||||
if [[ -d ".git" ]] ; then
|
||||
echo "[git]: Note $(pwd) is under Git revision control."
|
||||
. "$SCRIPTS/GitUpstreamer"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
#Scripts to detect and push changes if exist; Runs in Git direcories, called by GitDaemon script.
|
||||
source ~/.zshrc > /dev/null 2>&1
|
||||
#This system is opt in; only kick in if there's a .autocommit file.
|
||||
if [[ -f .autocommit ]]; then
|
||||
if [[ -z $(git status | grep "nothing") ]]; then
|
||||
#If working state is not clean - assume dirty directory
|
||||
echo "[git]: Directory $(pwd) has changes uncommited to git."
|
||||
echo "Auto-Commit detected changes?"
|
||||
read COMMIT
|
||||
if [[ $COMMIT == "Y" ]] || [[ $COMMIT == "y" ]]; then
|
||||
git add . -A #Adds only essentials via reverse gitignore
|
||||
echo "[git]: Committing changes..."
|
||||
git commit -m "Scripted commit - $(date)"
|
||||
git push >/dev/null 2>&1
|
||||
elif [[ $COMMIT == "N" ]] || [[ $COMMIT == "n" ]]; then
|
||||
echo "[git]: Ignoring changes per user request."
|
||||
fi
|
||||
elif [[ -n $(git status | grep "nothing") ]]; then
|
||||
echo "[git]: Directory has no uncommited changes."
|
||||
fi
|
||||
fi
|
||||
5
Okiru
5
Okiru
@@ -50,12 +50,11 @@ logging () {
|
||||
export REPORT="/home/shmick/Scripts/Logs/$1/$1"
|
||||
export PREFIX=$1
|
||||
fi
|
||||
ls $LOG
|
||||
if [[ -f "$LOG" ]]; then
|
||||
OLD_LOG_DATE=$(stat $LOG | grep Modify | awk '{print $2}' | sed -e 's/-//g')
|
||||
OLD_LOG_TIME=$(stat $LOG | grep Modify | awk '{print $3}' | sed -e 's/://g' | awk -F. '{print $1}')
|
||||
mv "$LOG" "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" 2> /dev/null
|
||||
zstd -11 --rm -f "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" > /dev/null
|
||||
mv "$LOG" "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" 2> /dev/null 2>&1
|
||||
zstd -11 --rm -f "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" > /dev/null 2>&1
|
||||
# ^ Append timestamp (YYYYMMDD_HHMMSS - ex 20210301_093543) to log if it exists
|
||||
fi
|
||||
touch $LOG
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
##Simple script to run Restic backups
|
||||
source /etc/zsh/zprofile > /dev/null 2>&1
|
||||
source /home/shmick/Scripts/Okiru
|
||||
source $SCRIPTS/Okiru
|
||||
logging Restic
|
||||
|
||||
#Safety function; accepts repository to check
|
||||
18
Vol-Sync
18
Vol-Sync
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
#Script to sync the Red-Vol when it comes up with the Tui64 share.
|
||||
INIT_DIR='/Red-Vol'
|
||||
FINAL_DIR='/rksmb/*'
|
||||
HOST_IP='192.168.1.66'
|
||||
|
||||
#Ping check
|
||||
ping -c 4 $HOST_IP > /dev/null
|
||||
#If there is ping, sync the Media and Backups subvolumes.
|
||||
if [[ $(echo $?) == 0 ]]; then
|
||||
sshpass -f /shmick/.ssh/sshpasskey rsync -aHAXv --progress --exclude="Torrents" shmick@$HOST_IP:$FINAL_DIR $INIT_DIR
|
||||
#No DNS resolution
|
||||
elif [[ $(echo $?) == 2 ]]; then
|
||||
echo "Could not resolve host."
|
||||
#No ping
|
||||
elif [[ $(echo $?) == 1 ]]; then
|
||||
echo "No communications with host."
|
||||
fi
|
||||
11
WindowsBoot
11
WindowsBoot
@@ -1,4 +1,11 @@
|
||||
#!/bin/bash
|
||||
source $GIT_SCRIPTS/Okiru
|
||||
WindowsEntry=$(efibootmgr | grep "Windows Boot Manager" | awk '{print $1}' | sed -e 's/Boot//g')
|
||||
efibootmgr -n $WindowsEntry
|
||||
reboot
|
||||
if [[ -n $WindowsEntry ]]; then
|
||||
debug "Found Windows entry: $WindowsEntry"
|
||||
ok "Found Windows! Rebooting"
|
||||
efibootmgr -n $WindowsEntry
|
||||
reboot
|
||||
else
|
||||
error "Found no Windows entry. SAD!"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user