mirror of
https://github.com/SinTan1729/random.git
synced 2025-04-19 09:10:00 -05:00
Compare commits
4 commits
010d0b8fc9
...
eb98c97d1a
Author | SHA1 | Date | |
---|---|---|---|
eb98c97d1a | |||
f1eec7186a | |||
5c3febc5c0 | |||
e3f528650a |
6 changed files with 50 additions and 27 deletions
0
DND.py
Executable file → Normal file
0
DND.py
Executable file → Normal file
0
DNDToggle.sh
Executable file → Normal file
0
DNDToggle.sh
Executable file → Normal file
26
OneDriveBk
26
OneDriveBk
|
@ -1,26 +0,0 @@
|
||||||
#!/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!"
|
|
||||||
|
|
49
OneDriveBk.sh
Normal file
49
OneDriveBk.sh
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/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
|
||||||
|
|
|
@ -67,7 +67,7 @@ echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
||||||
echo "--------------------------------------------------" | 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"
|
echo $(date) "| Backing up Forgejo data..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
||||||
rsync -aAXH --delete --stats "$HMDIR/Docker/forgejo/*-data" "$BKDIR/Programs/Docker/forgejo/" | 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"
|
||||||
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
||||||
|
|
||||||
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
|
||||||
|
|
0
qbt-set-forwarded-port.sh
Executable file → Normal file
0
qbt-set-forwarded-port.sh
Executable file → Normal file
Loading…
Reference in a new issue