Tracker

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Tracker's Achievements

Noob

Noob (1/14)

2

Reputation

  1. Following script iterates over the array entries, which contains the shares that needs to be backuped: #!/bin/bash PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin ## Available variables: # ACTION - if mounting, ADD; if unmounting, UNMOUNT; if unmounted, REMOVE; if error, ERROR_MOUNT, ERROR_UNMOUNT # DEVICE - partition device, e.g. /dev/sda1 # UD_DEVICE - unassigned devX designation # SERIAL - disk serial number # LABEL - partition label # LUKS - if the device is encrypted, this is the partition device, e.g. /dev/sda1 # FSTYPE - partition filesystem # MOUNTPOINT - where the partition is mounted # OWNER - "udev" if executed by UDEV, otherwise "user" # PROG_NAME - program name of this script # LOGFILE - log file for this script directorys=( "/mnt/user/folder1" "/mnt/user/folder2" "/mnt/user/folder3" "/boot/config/plugins/unassigned.devices") notify_event="<Name of NAS>" notify_subject="backup ext. disk" notify_message="Follwoing shares were synced:"$'\n' case $ACTION in 'ADD' ) # # Beep that the device is plugged in. # beep -l 200 -f 600 -n -l 200 -f 800 sleep 2 if mountpoint -q $MOUNTPOINT; then if [ $OWNER = "udev" ] then beep -l 100 -f 2000 -n -l 150 -f 3000 beep -l 100 -f 2000 -n -l 150 -f 3000 logger Started -t $PROG_NAME echo "Started: `date`" > $LOGFILE for dir in "${directorys[@]}"; do echo "#### Start: [`date`] ####" >> $LOGFILE echo "# sync of share: ${dir} #" >> $LOGFILE rsync -a -v "$dir" $MOUNTPOINT/ 2>&1 >> $LOGFILE echo "## End: [`date`] ##" >> $LOGFILE notify_message+="$dir"$'\n' done logger Syncing -t$PROG_NAME sync -f $MOUNTPOINT beep -l 100 -f 2000 -n -l 150 -f 3000 beep -l 100 -f 2000 -n -l 150 -f 3000 beep -r 5 -l 100 -f 2000 logger Unmounting Ext. HDDBackup Backup -t $PROG_NAME /usr/local/sbin/rc.unassigned umount $DEVICE echo "Completed: `date`" >> $LOGFILE logger Backup drive can be removed -t$PROG_NAME /usr/local/emhttp/webGui/scripts/notify -e "$notify_event" -s "$notify_subject" -d "Backup completed" -i "alert" -m "$notify_message" fi else logger Backup drive not mounted -t$PROG_NAME fi ;; 'REMOVE' ) # # Beep that the device is unmounted. # beep -l 200 -f 800 -n -l 200 -f 600 ;; 'ERROR_MOUNT' ) /usr/local/emhttp/webGui/scripts/notify -e "$notify_event" -s "$notify_subject" -d "Could not mount disk!" -i "alert" ;; 'ERROR_UNMOUNT' ) /usr/local/emhttp/webGui/scripts/notify -e "$notify_event" -s "$notify_subject" -d "Could not unmount disk!" -i "alert" ;; The mail notifcation works via "alert"-state for the notification method -> 'ERROR_MOUNT'/'ERROR_UNMOUNT' -> In the system settings of the NAS, under the notification conriguration, I configuered that system notification with alert state will send as mail to.
  2. Curently working on the script. Will post my work in a view days, when i have it optimized.
  3. @Hoopster do you have an example code for me, where I can see how the mail notification works and the copy implementation of some shares is shown?
  4. Hi everyone, I am searching for a backup solution, which starts autmatically the backup process on a attached external device and detache the device when backup is completed. Additionally a short notification e.g. via mail would be helpfull. Is their a kind of solution? I had this concept before with my old synology, to have manual backup. It was a additional fall back solution in the case of ransomware attack or fire/water damage. BR, Tracker