Created
January 23, 2022 13:29
-
-
Save mariuszmikolajczak/81339d73ba10069cea1f8f775cd45a52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source_dir="/var/lib/unifi/backup/autobackup/" | |
share_name="unifi-backups" | |
share_dest="/mnt/$share_name" | |
smb_ip="" | |
smb_user="unifi" | |
smb_password="" | |
isMounted () { findmnt "$1" >/dev/null;} | |
mkdir -p $share_dest | |
if ! isMounted "$share_dest"; then | |
mount -t cifs -o username=$smb_user,password=$smb_password //$smb_ip/$share_name $share_dest | |
fi | |
if isMounted "$share_dest"; then | |
rsync -a $source_dir $share_dest | |
umount $share_dest | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment