Added searching of repository with find command, closes #5
This commit is contained in:
parent
6848637b8e
commit
4db272d957
1 changed files with 14 additions and 4 deletions
18
backup.sh
18
backup.sh
|
@ -17,17 +17,18 @@ EOF
|
||||||
print_help () {
|
print_help () {
|
||||||
echo -e """
|
echo -e """
|
||||||
Usage:
|
Usage:
|
||||||
backup.sh 'command' 'destination'
|
backup.sh 'command' 'destination' 'input'
|
||||||
|
|
||||||
Supported Commands:
|
Supported Commands:
|
||||||
init - intiialize a new backup repository
|
|
||||||
backup - initiate a backup of the home folder to the destination
|
backup - initiate a backup of the home folder to the destination
|
||||||
check - check repository for consistency
|
check - check repository for consistency
|
||||||
snapshots - list backups on the destination
|
find - find a file by a string in the repository (requires input)
|
||||||
|
help - print this help
|
||||||
|
init - intiialize a new backup repository
|
||||||
prune - prune old backups on the destination
|
prune - prune old backups on the destination
|
||||||
|
snapshots - list backups on the destination
|
||||||
stats - print statistics about the backup repository
|
stats - print statistics about the backup repository
|
||||||
unlock - unlock a locked repository - use for stale locks
|
unlock - unlock a locked repository - use for stale locks
|
||||||
help - print this help
|
|
||||||
|
|
||||||
Required Configuration:
|
Required Configuration:
|
||||||
\$XDG_CONFIG_HOME/backup.sh/\$DESTINATION/\$DESTINATION.repo
|
\$XDG_CONFIG_HOME/backup.sh/\$DESTINATION/\$DESTINATION.repo
|
||||||
|
@ -62,6 +63,7 @@ set -o pipefail
|
||||||
|
|
||||||
ACTION=$1
|
ACTION=$1
|
||||||
DESTINATION=$2
|
DESTINATION=$2
|
||||||
|
INPUT="${@:3}"
|
||||||
|
|
||||||
if [[ -z $DESTINATION && $ACTION == "help" ]]; then
|
if [[ -z $DESTINATION && $ACTION == "help" ]]; then
|
||||||
print_logo
|
print_logo
|
||||||
|
@ -118,6 +120,14 @@ else
|
||||||
--verbose \
|
--verbose \
|
||||||
check | print_and_log
|
check | print_and_log
|
||||||
;;
|
;;
|
||||||
|
"find")
|
||||||
|
echo "Searching for $INPUT at $DESTINATION"
|
||||||
|
/usr/bin/restic \
|
||||||
|
-r "$BACKUP_REPOSITORY" \
|
||||||
|
-p "$BACKUP_PASSWORD" \
|
||||||
|
--verbose \
|
||||||
|
find $INPUT
|
||||||
|
;;
|
||||||
"init")
|
"init")
|
||||||
echo "Initializing backup repository at $DESTINATION" | print_and_log
|
echo "Initializing backup repository at $DESTINATION" | print_and_log
|
||||||
/usr/bin/restic \
|
/usr/bin/restic \
|
||||||
|
|
Loading…
Reference in a new issue