Skip to content

Instantly share code, notes, and snippets.

View lawipac's full-sized avatar
❤️
Happy Developing

Patrick Peng Sun lawipac

❤️
Happy Developing
View GitHub Profile
@upsuper
upsuper / bind-backup.sh
Last active March 13, 2024 17:08
Script to automatically bind and unbind external USB drive on Synology NAS
#!/bin/bash
SERIAL="00000000"
echo "Looking for device with serial $SERIAL..."
for d in /sys/bus/usb/devices/*-*; do
if [[ -f "$d/serial" ]]; then
serial=$(<"$d/serial")
if [[ "$serial" = "$SERIAL" ]]; then
device="$(basename $d)"