added new backp script and some modifications

This commit is contained in:
Sayantan Santra 2021-11-27 19:30:34 -06:00
parent 91e7f000b2
commit 68899bb73c
4 changed files with 61 additions and 1 deletions

22
OneDriveSync Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
if [ $(id -u) -eq 0 ]; then
exec sudo -H -u <user> $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!"

23
PhotoPrismAutoIndex Executable file
View file

@ -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 <user> $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..."

View file

@ -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=<user>, RUN+="/usr/local/bin/huion-tablet-mount"
# ACTION=="add", ATTRS{idVendor}=="256c", ATTRS{idProduct}=="006d", ENV{XAUTHORITY}="/home/<user>/.Xauthority", ENV{DISPLAY}=":0", OWNER=<user>, RUN+="/usr/local/bin/huion-tablet-mount"
# Make /usr/local/bin/huion-tablet-mount with this content :
# #!/bin/bash

15
impfilesbk Executable file
View file

@ -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