+HOME=/home/will
+SHELL=/bin/bash
# m h dom mon dow command
-0 */3 * * * bash ~/cron_bitcoin.sh >> ~/cron.log 2>&1
-1 */4 * * * bash ~/cron_weather.sh >> ~/cron.log 2>&1
-3 */6 * * * bash ~/cron_exchange_rate.sh >> ~/cron.log 2>&1
-4 */4 * * * bash ~/cron_log_maintainer.sh > /dev/null 2>&1
-7 */8 * * * bash ~/cron_postgreSQL_backup.sh >> ~/cron.log 2>&1
-9 */8 * * * bash ~/cron_backup_nuc_to_local.sh >> ~/cron.log 2>&1
-0 8 * * 0 bash ~/cron_backup_to_nuc.sh >> ~/cron.log 2>&1
-
+0 */3 * * * ~/cron_bitcoin.sh >> ~/cron.log 2>&1
+1 */4 * * * ~/cron_weather.sh >> ~/cron.log 2>&1
+3 */6 * * * ~/cron_exchange_rate.sh >> ~/cron.log 2>&1
+2 */16 * * * ~/cron_postgreSQL_backup.sh >> ~/cron.log 2>&1
+7 */16 * * * ~/cron_log_maintainer.sh >> ~/cron.log 2>&1
+9 */8 * * * ~/cron_backup_nuc_to_local.sh >> ~/cron.log 2>&1
+0 8 * * 0 ~/cron_backup_to_nuc.sh >> ~/cron.log 2>&1
+0 8 * * 1 ~/cron_clamscan.sh >> ~/cron.log 2>&1
#!/bin/bash
+CLR1=$'\x1b[38;5;87m' # cyan
+CLR2=$'\x1b[38;5;211m' # magenta
+CLR3=$'\x1b[38;5;120m' # green
+CLR4=$'\x1b[38;5;241m' # dim
+CLR5=$'\x1b[38;5;223m' # off-white (text)
+RST=$'\x1b[0m'
+
# Included backup.config file is only to be modified as the copy in -> ~/.config/backup.config
SRC_DIR=`dirname "$0"`
if [[ -f ~/.config/backup.config ]]; then
function showHelp (){
read -r -d '' help <<-__help
\e[1;31mBackup Utility \e[0m - by Will Budić (Mon 30 May 2022)\e[17m
- \e[32m This utility backups your home directory, via an backup.config file specified to an target directory.\e[0m
+ $CLR3 This utility backups your home directory, via an backup.config file specified to an target directory.\e[0m
\e[1;33mUsage:\e[0;32m
-
+$CLR3
backup - Uses all defaults, see/modify this settings in ~/.config/backup.config.
backup /media/path - Sets destination target to alternative /media/path, this will be checked.
-
+$RST
\e[1;33mOptions:\e[0m
- \e[0;37m--config\e[0;32m{=} {path} - Alternative to ~/.config/backup.config to load, potentialy overwritting default.
- This option is usually used in combination with the --name posfix.
+ \e[0;37m--config\e[0;32m{=} {path} - Alternative to ~/.config/backup.config to load, potentially overwriting default.
+ This option is usually used in combination with the --name postfix.
\e[0;37m--target\e[0;32m{=} {path} - Specifically assigned backup target path.
- \e[0;37m--name=\e[0;32m{word} - Assign posfix name for current run, the default config doesn't use it or set it,
- so an potetnially existing backup on the target will not be overwritten,
+ \e[0;37m--name=\e[0;32m{word} - Assign postfix name for current run, the default config doesn't use it or set it,
+ so an potentially existing backup on the target will not be overwritten,
i.e. while testing.
\e[0;37m--help\e[1;32m | \e[0;37m-?\e[0;32m - Prints this help.
-
+ $CLR3
The reason for the backup command being semi-automatic via an config file, is to expect have everything setup in that file
and usually run once in a week as a background cron job. Or from the command line.
As an typical backup can take an long time to run. Use the enarch utility (file://$SRC_DIR/enarch.pl),
for smaller e-safe archives instead.
The resulting backup will be both encrypted and compressed as the final product.
+ $RST
\e[31mWarning\e[0m -> \e[0;32mDo not keep an copy of the key or config file on the target or server computer. Store it in a password manager.
Recomended passwprd manaker I use is -> https://keepassxc.org/
done
if [[ ! -z $directories ]]; then
- stat_m="Collecting files from: $directories";
+ stat_m="Collecting files from: CLR1 $directories $RST";
echo "$stat_m";
stat_glob+="$stat_m\n";
+ echo -e " /usr/bin/fdfind -H -t file -I $EXCLUDES . $directories | sort -d >> $BCK_LST" ;
/usr/bin/fdfind -H -t file -I $EXCLUDES . $directories | sort -d >> $BCK_LST;
[[ $? != 0 ]] && exit $?;
fi
if [[ "$BACKUP_VERBOSE" -eq 1 ]]; then
while NFS= read -r file;
do if [[ -n "$file" ]]; then
- size=$(stat -c %s "$file");
- file_cnt=$(($file_cnt + 1));
- file_size=$(($file_size + $size));
- file_size=$(($file_size + ${#file}));
+ if [[ -f $file ]]; then
+ size=$(stat -c %s "$file");
+ file_cnt=$(($file_cnt + 1));
+ file_size=$(($file_size + $size));
+ file_size=$(($file_size + ${#file}));
+ else
+ echo -e $CLR2 "Skipping not valid file ->$file" $CLR1
+ fi
fi
- done < <(pv -N "Please wait, obtaining all file stats..." -pt -w 100 $BCK_LST);
+ done < <(pv -N "$CLR2 Please wait, obtaining all file stats...$CLR1" -pt -w 100 $BCK_LST);
target_avail_space=$(df "$TARGET" | awk '{print $4}' | tail -n 1);
file_size_formated=$(numfmt --to=iec-i "$file_size");
fi
printLine;
- echo " Started archiving! Archive Bulk to Compress is: $file_size_formated";
+ echo "$CLR5 Started archiving! Archive Bulk to Compress is: $file_size_formated";
printLine;
# Notice - tar archives and compresses in blocks, piped out to pv is not actual byte mass, hence no lineral progressbar.
--- /dev/null
+amodio.tsl-problem-matcher
+analytic-signal.preview-html
+bierner.github-markdown-preview
+bierner.markdown-checkbox
+bierner.markdown-emoji
+bierner.markdown-footnotes
+bierner.markdown-mermaid
+bierner.markdown-preview-github-styles
+bscan.perlnavigator
+christian-kohler.npm-intellisense
+davidanson.vscode-markdownlint
+dbaeumer.vscode-eslint
+donjayamanne.githistory
+duox32.next
+duox32.next-edu
+duox32.next-snippets
+eamodio.gitlens
+ecmel.vscode-html-css
+esbenp.prettier-vscode
+firefox-devtools.vscode-firefox-debug
+formulahendry.auto-rename-tag
+formulahendry.code-runner
+george-alisson.html-preview-vscode
+gingerturtle.html-preview-pro
+github.vscode-pull-request-github
+huizhou.githd
+jannek-aalto.shell-function-outline
+jeff-hykin.better-perl-syntax
+jock.svg
+johnpapa.winteriscoming
+jsynowiec.vscode-insertdatestring
+lakshits11.monokai-pirokai
+loczek.next-js-ts-snippets
+mdickin.markdown-shortcuts
+ms-azuretools.vscode-containers
+ms-python.debugpy
+ms-python.python
+ms-python.vscode-pylance
+ms-python.vscode-python-envs
+ms-vscode-remote.remote-containers
+ms-vscode.cpptools
+ms-vscode.extension-test-runner
+ms-vscode.js-debug-nightly
+ms-vscode.live-server
+ms-vscode.remote-explorer
+ms-vscode.remote-server
+richterger.perl
+rogalmic.bash-debug
+shakram02.bash-beautify
+shd101wyy.markdown-preview-enhanced
+sidthesloth.html5-boilerplate
+solnurkarim.html-to-css-autocompletion
+streetsidesoftware.code-spell-checker
+streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries
+sumneko.lua
+techer.open-in-browser
+theliraan.simpleaccents
+torrentalle.perl-moose
+tshino.kb-macro
+undefined_publisher.perlcnf-extension
+utgwkk.perl-rename-symbol
+visualstudioexptteam.intellicode-api-usage-examples
+visualstudioexptteam.vscodeintellicode
+wbudic.perlcnf
+wscats.cors-browser
+yzhang.markdown-all-in-one