From 64e605c546cdcf141ca7d75010ed4f1c4d462f4f Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Sat, 15 Feb 2020 08:43:15 +0000 Subject: [PATCH] show IOMMU groups and backup work script --- transcode_music.sh | 20 ++++++++++++-------- backup.sh | 29 +++++++++++++++++++++++++++++ IOMMU.sh | 8 ++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/IOMMU.sh b/IOMMU.sh new file mode 100755 index 0000000..2dad4c6 --- /dev/null +++ b/IOMMU.sh @@ -0,0 +1,8 @@ +#!/bin/bash +shopt -s nullglob +for g in /sys/kernel/iommu_groups/*; do + echo "IOMMU Group ${g##*/}:" + for d in $g/devices/*; do + echo -e "\t$(lspci -nns ${d##*/})" + done; +done; diff --git a/backup.sh b/backup.sh new file mode 100755 index 0000000..21f8aea --- /dev/null +++ b/backup.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +cd /home/joel/OneDrive + +LAST="$(duplicacy list | tail -n1 | cut -d' ' -f4)" +CURR="$(duplicacy backup | grep "revision [0-9] completed" | sed 's/[^0-9]//g')" +#LAST=2 +#CURR=4 +DIFF="$(duplicacy diff -r $CURR -r $LAST | grep '-')" + +#echo "curr - $CURR" +#echo "last - $LAST" +#echo "diff - $DIFF" + +if [ -z "$DIFF" ]; then + duplicacy prune -r $CURR -exclusive +else + echo "No diff to backup" +fi +duplicacy prune -keep 1:7 -keep 7:30 -exclusive + +BACKUP_DIR="/backup/work/" +rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni & +rclone sync $BACKUP_DIR "NextCloud":/Uni & +rclone sync $BACKUP_DIR "GoogleDrive":/Uni & +rclone sync $BACKUP_DIR "Mega":/Uni & +rclone sync $BACKUP_DIR "unimelb":/ & +rclone sync $BACKUP_DIR "sout":/data/Cloud & +#rclone sync $BACKUP_DIR "Oracle":/Uni diff --git a/transcode_music.sh b/transcode_music.sh index 27180f3..00c1c08 100755 --- a/transcode_music.sh +++ b/transcode_music.sh @@ -2,7 +2,17 @@ # Script to transcode music in buld using ffmpeg -bitrate=192000 +bitrate=192 + +transcode() { + if [ "ffprobe $1 2>&1 | grep bitrate | cut -d' ' -f8" > 192000 ]; then + echo in $1 + echo out "trans_music/$(echo ${1%.*} | cut -f1 -d'/' --complement).mp3" + ffmpeg -i "$d" -b:a $bitrate "trans_music/$(echo ${1%.*}).mp3"#| cut -f1 -d'/' --complement).mp3" + else + cp "$d" "trans_music/$(echo $1)" # | cut -f1 -d'/' --complement)" + fi +} shopt -s globstar @@ -12,11 +22,5 @@ cp -r --attributes-only Music/* trans_music/ find trans_music -type f -delete for d in **/*.{mp3,flac,mp4,m4a,ogg}; do - if [ "ffprobe -show_format 2>/dev/null $d | grep bit_rate | cut -d'=' -f2" > 192000 ]; then - echo in $d - echo out "trans_music/$(echo ${d%.*} | cut -f1 -d'/' --complement).mp3" - ffmpeg -i "$d" -b:a $bitrate "trans_music/$(echo ${d%.*} | cut -f1 -d'/' --complement).mp3" - else - cp "$d" "trans_music/$(echo $d | cut -f1 -d'/' --complement)" - fi + transcode $d & done -- Gitblit v1.9.3