From ab6b1d71e93967aa1d00e0026cb75ac2ffbfc11a Mon Sep 17 00:00:00 2001 From: Joursoir Date: Sat, 14 Oct 2023 20:01:00 +0300 Subject: rename 'bin' dir to 'scripts' --- bin/do-backup.sh | 23 ----------------------- bin/scregcp.sh | 39 --------------------------------------- scripts/do-backup.sh | 23 +++++++++++++++++++++++ scripts/scregcp.sh | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 62 deletions(-) delete mode 100755 bin/do-backup.sh delete mode 100644 bin/scregcp.sh create mode 100755 scripts/do-backup.sh create mode 100644 scripts/scregcp.sh diff --git a/bin/do-backup.sh b/bin/do-backup.sh deleted file mode 100755 index 02350e5..0000000 --- a/bin/do-backup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# -# Dependencies: 'rsync' - -backupdir=/mnt/storage/backups -logdir=$backupdir/logs -originserver="user@example.com" -tdate=$(date +%Y%m%d) - -# Rsync options: -# a = archive mode (symbolic links, attributes, permissions, -# ownerships, etc. are preserved in the transfer) -# z = compress file data during the transfer -# v = increase verbosity -# h = output numbers in a human-readable format -# -# A trailing *slash* on the _source_ changes this behavior to avoid -# creating an additional directory level at the _destination_. -mkdir -p $backupdir/$tdate && \ -rsync -azvh --progress $originserver:/ \ - --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \ - "$backupdir/$tdate" \ - --log-file="$logdir/$tdate.log" diff --git a/bin/scregcp.sh b/bin/scregcp.sh deleted file mode 100644 index 2f2bab2..0000000 --- a/bin/scregcp.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -# Dependencies: 'imagemagick', 'xclip' - -function help_and_exit { - if [ -n "${1}" ]; then - echo "${1}" - fi - cat <<-EOF - Usage: scregcp [-h|-s] [] - - Take screenshot of a whole screen or a specified region, - save it to a specified folder (current folder is default) - and copy it to a clipboard. - - -h - print help and exit - -s - take a screenshot of a screen region -EOF - if [ -n "${1}" ]; then - exit 1 - fi - exit 0 -} - -if [ "${1}" == '-h' ]; then - help_and_exit -elif [ "${1:0:1}" == '-' ]; then - if [ "${1}" != '-s' ]; then - help_and_exit "error: unknown option ${1}" - fi - base_folder="${2}" -else - base_folder="${1}" - params="-window root" -fi - -file_path=${base_folder}$( date '+%Y-%m-%d_%H-%M-%S' )_screenshot.png -import ${params} ${file_path} -xclip -selection clipboard -target image/png -i < ${file_path} diff --git a/scripts/do-backup.sh b/scripts/do-backup.sh new file mode 100755 index 0000000..02350e5 --- /dev/null +++ b/scripts/do-backup.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Dependencies: 'rsync' + +backupdir=/mnt/storage/backups +logdir=$backupdir/logs +originserver="user@example.com" +tdate=$(date +%Y%m%d) + +# Rsync options: +# a = archive mode (symbolic links, attributes, permissions, +# ownerships, etc. are preserved in the transfer) +# z = compress file data during the transfer +# v = increase verbosity +# h = output numbers in a human-readable format +# +# A trailing *slash* on the _source_ changes this behavior to avoid +# creating an additional directory level at the _destination_. +mkdir -p $backupdir/$tdate && \ +rsync -azvh --progress $originserver:/ \ + --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \ + "$backupdir/$tdate" \ + --log-file="$logdir/$tdate.log" diff --git a/scripts/scregcp.sh b/scripts/scregcp.sh new file mode 100644 index 0000000..2f2bab2 --- /dev/null +++ b/scripts/scregcp.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# Dependencies: 'imagemagick', 'xclip' + +function help_and_exit { + if [ -n "${1}" ]; then + echo "${1}" + fi + cat <<-EOF + Usage: scregcp [-h|-s] [] + + Take screenshot of a whole screen or a specified region, + save it to a specified folder (current folder is default) + and copy it to a clipboard. + + -h - print help and exit + -s - take a screenshot of a screen region +EOF + if [ -n "${1}" ]; then + exit 1 + fi + exit 0 +} + +if [ "${1}" == '-h' ]; then + help_and_exit +elif [ "${1:0:1}" == '-' ]; then + if [ "${1}" != '-s' ]; then + help_and_exit "error: unknown option ${1}" + fi + base_folder="${2}" +else + base_folder="${1}" + params="-window root" +fi + +file_path=${base_folder}$( date '+%Y-%m-%d_%H-%M-%S' )_screenshot.png +import ${params} ${file_path} +xclip -selection clipboard -target image/png -i < ${file_path} -- cgit v1.2.3-18-g5258