1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2025-04-19 17:20:00 -05:00

Compare commits

..

No commits in common. "eb98c97d1a79b43f8636036f339982d12381d9bc" and "010d0b8fc918dd38a4331dd0b213e59bb9d8c488" have entirely different histories.

6 changed files with 27 additions and 50 deletions

0
DND.py Normal file → Executable file
View file

0
DNDToggle.sh Normal file → Executable file
View file

26
OneDriveBk Normal file
View file

@ -0,0 +1,26 @@
#!/bin/sh
# For backing up files with OneDrive
# Assumes that the backup target is set up as OneDrive in rclone
if [ $(id -u) -eq 0 ]; then
exec sudo -H -u sintan $0 "$@"
fi
notify() {
#Detect the name of the display in use
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
#Detect the user using such display
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
#Detect the id of the user
local uid=$(id -u $user)
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send -a rclone -h string:desktop-entry:alacritty "$@"
}
notify "OneDriveBk" "Backup started..."
flock -n /tmp/onedrivesync.lock rclone sync -c -L --log-file="/home/sintan/TempStorage/OneDriveBk.log" --log-level INFO "/home/sintan/TempStorage/OneDrive/" OneDrive:Backup
notify "OneDriveBk" "Backup finished!"

View file

@ -1,49 +0,0 @@
#!/usr/bin/env bash
# For backing up files with OneDrive, from my server.
# Assumes that the backup target is set up as encrypted-onedrive in rclone.
# I usually run it once a week by a cronjob.
# force script to run as specific user
if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@"
fi
# Exit the whole script when ctrl+c is pressed
set -e
# Run only one instance of this script at one time
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/onedrivebk.lock" "$0" "$@" || :
# List of backups
LOGFILE="/home/sintan/TempStorage/OneDriveBk.log"
echo "Starting Backup" | tee -a $LOGFILE
date | tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Pictures" encrypted-onedrive:"Pictures" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Videos" encrypted-onedrive:"Videos" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Academics" encrypted-onedrive:"Academics" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Zotero" encrypted-onedrive:"Zotero" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/mnt/storage/Music" encrypted-onedrive:"Music" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M sync --exclude="**/.stversions/**" --exclude="/CalibreLibrary/**" \
"/mnt/storage/Documents" encrypted-onedrive:"Documents" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --exclude="**/menus/**" --exclude="**/unity3d/**" \
--exclude="**/libreoffice/**" --ignore-errors --bwlimit 4M sync "/mnt/storage/dotfiles" encrypted-onedrive:"dotfiles" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M --exclude="**/.stfolders/**" \
--exclude="**/.trashed**" --delete-excluded sync "/home/sintan/TempStorage/DCIM" encrypted-onedrive:"DCIM" |& tee -a $LOGFILE
rclone -v --fast-list --size-only --links --bwlimit 4M --exclude="*-config/**" sync "/mnt/storage/Programs" \
encrypted-onedrive:"Programs" |& tee -a $LOGFILE
echo "-----------------------------" | tee -a $LOGFILE
echo "-----------------------------" | tee -a $LOGFILE

View file

@ -67,7 +67,7 @@ echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $(date) "| Backing up Forgejo data..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/forgejo/forgejo-data" "$HMDIR/Docker/forgejo/postgres-data" "$BKDIR/Programs/Docker/forgejo-config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/forgejo/*-data" "$BKDIR/Programs/Docker/forgejo/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"

0
qbt-set-forwarded-port.sh Normal file → Executable file
View file