Compare commits

...

2 Commits

Author SHA1 Message Date
0f118e015e
inotifywait-cp 2022-09-28 07:41:07 +08:00
af93865525
add-apt-repository -y 2022-09-28 07:40:55 +08:00
7 changed files with 44 additions and 5 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.bak *.bak
*.log

View File

@ -1,4 +1,4 @@
# Autogenerated at 26.08.2022 08:21 using ./gen-makefile # Autogenerated at 28.09.2022 07:40 using ./gen-makefile
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
#=============================================== #===============================================

View File

@ -7,5 +7,5 @@ echo "Installing Canon Pixma MG2500 + ppa..."
echo "===============================================" echo "==============================================="
echo echo
sudo add-apt-repository ppa:thierry-f/fork-michael-gruz sudo add-apt-repository -y ppa:thierry-f/fork-michael-gruz
sudo apt install cnijfilter-mg2500series scangearmp-mg2500series sudo apt install cnijfilter-mg2500series scangearmp-mg2500series

View File

@ -7,5 +7,5 @@ echo "Installing grub-customizer (latest)..."
echo "===============================================" echo "==============================================="
echo echo
sudo add-apt-repository ppa:danielrichter2007/grub-customizer sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer
sudo apt install -y --autoremove grub-customizer sudo apt install -y --autoremove grub-customizer

View File

@ -7,5 +7,5 @@ echo "Installing ulauncher (latest) + ppa..."
echo "===============================================" echo "==============================================="
echo echo
sudo add-apt-repository ppa:agornostal/ulauncher sudo add-apt-repository -y ppa:agornostal/ulauncher
sudo apt install -y --autoremove ulauncher sudo apt install -y --autoremove ulauncher

View File

@ -9,6 +9,6 @@ echo
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' sudo add-apt-repository -y 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt install -y --autoremove winehq-stable sudo apt install -y --autoremove winehq-stable
wine --version wine --version

38
tools/inotifywait-cp.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# My use case:
# syncthing synchronizes ALL changes in DCIM directory on my android to PC.
# I wanted files to be copied somewhere else on my PC to stay forever, so I
# could sort them later and safely free some space on mobile without loss.
# Also I wish to have some stupid log with history of such events.
# inotify-tools package must be installed!
# CHANGE THIS PARAMETERS to ones you needed
dir_src="$HOME/Syncthing/Mobile/Camera"
dir_dest="$HOME/some/safe/place"
dir_logs="$HOME/inotifywait-cp-logs"
regexp="[0-9]{8}_[0-9]{6}.*\.(jpg|mp4|gif)"
# Arguments description:
# --quiet -- print less (only print events)
# --monitor -- don't stop after first event (like infinite loop)
# --event -- first syncthing creates hidden file to write data into
# then renames it according to source file name, so here
# we listen to MOVED_TO event to catch final filename
# --format %f -- print only filename
# --include -- filename regexp to catch event from, ensure your $regexp
# is correct or remove line 32 to catch synced ALL files
mkdir -p "$dir_dest" "$dir_logs"
inotifywait \
--quiet \
--monitor \
--event moved_to \
--format %f \
--include "$regexp" \
"$dir_src" \
| while read filename; do
cp "$dir_src/$filename" "$dir_dest/$filename"
echo "[`date '+%H:%M:%S'`] COPIED: $dir_src/$filename => $dir_dest/$filename" \
| tee -a "$dir_logs/`date '+%Y%m%d'`.log"
done