mirror of https://github.com/Chizi123/Scripts.git

Joel Grunbaum
2020-02-15 64e605c546cdcf141ca7d75010ed4f1c4d462f4f
show IOMMU groups and backup work script
1 files modified
2 files added
57 ■■■■ changed files
IOMMU.sh 8 ●●●●● patch | view | raw | blame | history
backup.sh 29 ●●●●● patch | view | raw | blame | history
transcode_music.sh 20 ●●●●● patch | view | raw | blame | history
IOMMU.sh
New file
@@ -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;
backup.sh
New file
@@ -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
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