From 68899bb73c8a402f3ab09c312688a2197473484f Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sat, 27 Nov 2021 19:30:34 -0600 Subject: [PATCH] added new backp script and some modifications --- OneDriveSync | 22 ++++++++++++++++++++++ PhotoPrismAutoIndex | 23 +++++++++++++++++++++++ huion-tablet-setup.sh | 2 +- impfilesbk | 15 +++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 OneDriveSync create mode 100755 PhotoPrismAutoIndex create mode 100755 impfilesbk diff --git a/OneDriveSync b/OneDriveSync new file mode 100755 index 0000000..06241e6 --- /dev/null +++ b/OneDriveSync @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $(id -u) -eq 0 ]; then + exec sudo -H -u $0 "$@" +fi + +function notify-send2() { + #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-send2 "OneDrive sync" "Sync started..." +flock -n .onedrivesynclock rclone sync -c -L --log-file=logfile --log-level INFO source OneDrive:Syncs +notify-send2 "OneDrive sync" "Sync finished!" diff --git a/PhotoPrismAutoIndex b/PhotoPrismAutoIndex new file mode 100755 index 0000000..df6dd10 --- /dev/null +++ b/PhotoPrismAutoIndex @@ -0,0 +1,23 @@ +#!/bin/bash + +# If started as root, then re-start as user "gavenkoa": +if [ "$(id -u)" -eq 0 ]; then + exec sudo -H -u $0 "$@" +fi + +function notify-send2() { + #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-send2 "PhotoPrism autoindex" "Indexing started..." +sudo /usr/bin/docker exec -it photoprism_photoprism_1 /photoprism/bin/photoprism index +notify-send2 "PhotoPrism autoindex" "Indexing finished..." diff --git a/huion-tablet-setup.sh b/huion-tablet-setup.sh index 25e6c48..64a8a9e 100755 --- a/huion-tablet-setup.sh +++ b/huion-tablet-setup.sh @@ -8,7 +8,7 @@ # sudo make dkms_install # Make /etc/udev/rules.d/00-usb-huion.rules with this content (to run it whenever the tabler is conencted): -# ACTION=="add", ATTRS{idVendor}=="256c", ATTRS{idProduct}=="006d", ENV{XAUTHORITY}="/home/sintan/.Xauthority", ENV{DISPLAY}=":0", OWNER=, RUN+="/usr/local/bin/huion-tablet-mount" +# ACTION=="add", ATTRS{idVendor}=="256c", ATTRS{idProduct}=="006d", ENV{XAUTHORITY}="/home//.Xauthority", ENV{DISPLAY}=":0", OWNER=, RUN+="/usr/local/bin/huion-tablet-mount" # Make /usr/local/bin/huion-tablet-mount with this content : # #!/bin/bash diff --git a/impfilesbk b/impfilesbk new file mode 100755 index 0000000..535bead --- /dev/null +++ b/impfilesbk @@ -0,0 +1,15 @@ +#!/bin/bash + +# This is to backup some important stuff + +echo `date` "| Backing up Documents..." | tee -a logfile +rsync -aAXH --delete source dest +echo "Done!" | tee -a logfile + +echo `date` "| Backing up Academics..." | tee -a logfile +rsync -aAXH --delete source dest +echo "Done!" | tee -a logfile + +echo `date` "| Backing up Pictures..." | tee -a logfile +rsync -aAXH --delete source dest +echo "Done!" | tee -a logfile