publications:synology_trigger_hyper_backup_on_usb_connect
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
publications:synology_trigger_hyper_backup_on_usb_connect [2020/01/08 19:44] – [Trigger check] Maik Wodarz | publications:synology_trigger_hyper_backup_on_usb_connect [2022/05/01 11:01] (current) – Maik Wodarz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== About ====== | ====== About ====== | ||
- | This article describes how can be configured an automatic USB hyperbackup, which is triggered by USB-connect. | + | This article describes how can be configured an automatic USB //hyper backup//, which is triggered by USB-connect. |
====== Introduction ====== | ====== Introduction ====== | ||
- | The synology diskstation | + | The //Synology Diskstation (DS)// |
My DS-216 has a copy button. | My DS-216 has a copy button. | ||
- | Using the app forseen | + | Using the app foreseen |
- | When we talk about backups this is a quite poor solution. | + | Talking |
- | In addition the copy button action can only handle the front usb port of the Synology. | + | In addition, the // |
- | My solution is derived from Bernd Distler' | + | My solution is derived from Bernd Distler' |
I wanted to find a solution without third party software. | I wanted to find a solution without third party software. | ||
- | The following article describes preconditions, | + | The following article describes preconditions, |
====== Preconditions ====== | ====== Preconditions ====== | ||
* SSH access to Synology NAS is enabled and the user is aware how to use it | * SSH access to Synology NAS is enabled and the user is aware how to use it | ||
* Basic knowledge about usage of BASH and VI editor | * Basic knowledge about usage of BASH and VI editor | ||
- | * Synology | + | * //Synology Hyper backup// app is installed |
- | * Synlogy | + | * //Synlogy |
* //Hyper backup// tasks using USB are configured | * //Hyper backup// tasks using USB are configured | ||
====== Overview - general workflow ====== | ====== Overview - general workflow ====== | ||
- | * Create a cron job which checkt | + | * Create a cron job which checks |
* Create an USB copy job using // | * Create an USB copy job using // | ||
- | * When the cron job finds the trigger file and there is still no active job (activity file) | + | * When the cron job finds the trigger file and there is still no active job (activity file), then: |
* Remember that a job is active => create the activity file (using touch) | * Remember that a job is active => create the activity file (using touch) | ||
* Remove the trigger file | * Remove the trigger file | ||
Line 38: | Line 38: | ||
====== USB-Copy ====== | ====== USB-Copy ====== | ||
- | Originaly | + | Originally |
- | Actions caused by copy button are affecting only the fron USB port while USB detecting actions are working for the back site USB ports as well. | + | Actions caused by copy button are affecting only the front USB port while USB detecting actions are working for the back site USB ports as well. |
- | For my objective – triggering a hyper backup job – I simply copy a flag file from predefined location on USB drive to a predefined location on NAS. So after connecting the USB drive a file named autobackup is copied to | + | For my objective – triggering a // |
/ | / | ||
The following screenshot is depicting it. | The following screenshot is depicting it. | ||
Line 58: | Line 58: | ||
The // | The // | ||
- | After finishing the trigger file it beebs again twice. | + | After finishing the trigger file it beeps again twice. |
====== Trigger check ====== | ====== Trigger check ====== | ||
The trigger checker script / | The trigger checker script / | ||
{{: | {{: | ||
- | First the script is checking if it is running already. (avoid duplicate run) | + | First, the script is checking if it is running already. (avoid duplicate run) |
In order to do so it checks if the activity file exists. (''/ | In order to do so it checks if the activity file exists. (''/ | ||
Line 69: | Line 69: | ||
If the activity file exists, it terminates immediately. Otherwise it continues. | If the activity file exists, it terminates immediately. Otherwise it continues. | ||
- | Then it determines the trigger file counts. (counts | + | Then it determines the trigger file counts. (count directory entries in: |
/ | / | ||
Line 144: | Line 144: | ||
====== Synousbcopy ====== | ====== Synousbcopy ====== | ||
- | ''/ | + | ''/ |
- | What can synousbcopy do for us? | + | What can '' |
/ | / | ||
Shows the help. | Shows the help. | ||
Line 160: | Line 160: | ||
====== Script startDatenBackup.sh ====== | ====== Script startDatenBackup.sh ====== | ||
- | This script or the corresponding counterpart startMediaBackup.sh is the heart of the trigger process. | + | This script or the corresponding counterpart |
It does the following: | It does the following: | ||
* activate copy LED blinking | * activate copy LED blinking | ||
- | * triggers hyper backup task | + | * triggers |
* waits until the hyper backup task finishes. | * waits until the hyper backup task finishes. | ||
* Deactivates the copy LED | * Deactivates the copy LED |
publications/synology_trigger_hyper_backup_on_usb_connect.1578512697.txt.gz · Last modified: 2020/01/08 19:44 by Maik Wodarz