Skip to content

Commit

Permalink
in rclone_jobber.sh, change 'if source is empty' test to use rclone lsf
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv6 committed Aug 10, 2019
1 parent 7c6eb87 commit 4a53462
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/job_backup_to_USB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ monitoring_URL=""

$rclone_jobber/rclone_jobber.sh "$source" "$dest" "$move_old_files_to" "$options" "$(basename $0)" "$monitoring_URL"

#display test directories (comment these if calling from job scheduler)
#display test directories (display for tutorial only, don't do this in production)
tree -a $source
tree -a $dest
2 changes: 1 addition & 1 deletion examples/job_backup_to_USB_excld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ monitoring_URL=""

$rclone_jobber/rclone_jobber.sh "$source" "$dest" "$move_old_files_to" "$options" "$(basename $0)" "$monitoring_URL"

#display test directories (comment these if calling from job scheduler)
#display test directories (display for tutorial only, don't do this in production)
tree -a $source
tree -a $dest
2 changes: 1 addition & 1 deletion examples/job_backup_to_USB_minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ options="--dry-run"

$rclone_jobber/rclone_jobber.sh "$source" "$dest" "$move_old_files_to" "$options" "$(basename $0)"

#display test directories (comment these if calling from job scheduler)
#display test directories (display for tutorial only, don't do this in production)
tree -a $source
tree -a $dest
2 changes: 1 addition & 1 deletion examples/job_backup_to_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ monitoring_URL=""

$rclone_jobber/rclone_jobber.sh "$source" "$dest" "$move_old_files_to" "$options" "$(basename $0)" "$monitoring_URL"

#display test directories (comment these if calling from job scheduler)
#display test directories (display for tutorial only, don't do this in production)
tree -a $source
rclone ls $dest
4 changes: 2 additions & 2 deletions rclone_jobber.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
# rclone_jobber.sh version 1.5.3
# rclone_jobber.sh version 1.5.4
# Tutorial, backup-job examples, and source code at https://github.com/wolfv6/rclone_jobber
# Logging options are headed by "# set log". Details are in the tutorial's "Logging options" section.

Expand Down Expand Up @@ -79,7 +79,7 @@ if [ -z "$dest" ]; then
fi

# if source is empty
if ! ( rclone ls -q $source | grep -q . ); then
if ! test "$(rclone lsf --max-depth 1 $source)"; then # rclone lsf requires rclone 1.40 or later
print_message "ERROR" "aborted because source is empty."
exit 1
fi
Expand Down
25 changes: 15 additions & 10 deletions rclone_jobber_tutorial.org
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ For example, Linux shell will substitute $rclone_jobber and $usb in:
: dest="$usb/test_rclone_backup"
There is no need to edit the scripts.

If you're on Linux, automate the substitution of path variables from your .profile.
If you're on Linux, automate the substitution of path variables from your .profile
(for tutorial scripts only, don't do this for production).
Add these lines to your ~/.profile (or ~/.bash_profile) file, but with your system paths:
: export rclone_jobber="/home/wolfv/rclone_jobber"
: export usb="/media/wolfv/USB_device_name"
and reload .profile:
: $ source ~/.profile

The above "usb" is just a variable name used in the examples, it doesn't actually have to be a USB drive.
For example:
: export usb="/home/wolfv/test_rclone"

If you can't edit your .profile, edit the example scripts:
Reload the .profile:
: $ source ~/.profile

To use a tutorial example script as a template for production backups, edit the tutorial scripts:
replace occurrences of "$rclone_jobber" and "$usb" with your system's paths.

The example scripts use the following environment path variables:
Expand All @@ -114,13 +116,18 @@ Here is a minimal backup-job script for rclone_jobber:

The last line calls rclone_jobber.sh with arguments =source= and =dest=.

Open the [[./examples/job_backup_to_USB_minimal.sh][examples/job_backup_to_USB_minimal.sh]] in your favorite [[https://en.wikipedia.org/wiki/Text_editor][text editor]].
Open the [[./examples/job_backup_to_USB_minimal.sh][examples/job_backup_to_USB_minimal.sh]] in your favorite text editor.
Set options to =--dry-run=:
: options="--dry-run"

Run the backup job:
: $ ~/rclone_jobber/examples/job_backup_to_USB_minimal.sh

No backup was created because --dry-run.

*Important:* A bad backup job can cause data loss.
First test with the =--dry-run= flag to see exactly what would be copied and deleted.

Here are some more things you can try with rclone_jobber:
1. Open rclone_jobber.log (rclone_jobber.log is in the same directory as rclone_jobber.sh).
2. Run the backup job again, this time without =--dry-run=.
Expand All @@ -132,9 +139,6 @@ Here are some more things you can try with rclone_jobber:
- move a file
And run the backup job again.

*Important:* A bad backup job can cause data loss.
First test with the =--dry-run= flag to see exactly what would be copied and deleted.

* Backup job and rclone_jobber.sh parameters
** Backup job script
Each backup job contains arguments and a call to rclone_jobber.sh.
Expand Down Expand Up @@ -329,13 +333,14 @@ The remote's password is stored in the rclone.conf file, so be careful about giv
To list all your rclone remotes:
: $ rclone listremotes

Here is how to run the tutorial's example remote backup job on Linux.
Here is how to run the tutorial's example remote backup job on Linux
(for tutorial scripts only, don't do this for production).
Add this line to your ~/.profile file, but with your remote path:
: export remote="onedrive_test_rclone_backup"
and reload .profile:
: $ source ~/.profile

If you can't edit your .profile, edit the example scripts:
To use a tutorial example script as a template for production backups, edit the tutorial scripts:
replace occurrences of "${remote}" with your remote path.

To test your remote, run:
Expand Down

0 comments on commit 4a53462

Please sign in to comment.