I need an ash (or Bash) script for my synology nas
The script needs to do the following steps:
1. check on what USB port there is an USB drive connected. (if non send email to specified email adres)
2. If there are 2 USB drives connected look for one with a directory called "backup" on it (if non send email to specified email adres)
3. Clear all contents in that backup directory if:
3a. in a separated file called "dirlist" there are the directories mentioned which needs to be in the backup
3b. check if there is enough diskspace on the USB drive if the directory "backup" has been cleared (if not send error mail to specified email adres)
4c. Clear all contents in that backup directory
4. make backup via rsync of all the data in the directories specified in the "dirlist" file
5. send email to specified email adres with how long the backup took and if backup was successful or not.
Note: a synology NAS is just a stripped linux. the script shall be placed in cron via the synology manager.