Skip to content

Instantly share code, notes, and snippets.

@georgkreimer
Last active December 17, 2025 12:42
Show Gist options
  • Select an option

  • Save georgkreimer/ee468224773400dc2a695f2d69048398 to your computer and use it in GitHub Desktop.

Select an option

Save georgkreimer/ee468224773400dc2a695f2d69048398 to your computer and use it in GitHub Desktop.
bootscript for the synology task scheduler to take care of the zigbee usb stick
#!/bin/sh
set -eu
VIDPID="10c4:ea60"
DEV="/dev/ttyUSB0"
LOADER="/usr/local/etc/rc.d/usb-serial-drivers.sh"
log() { echo "$(date -Iseconds) $*"; }
fail() { log "FAIL: $*"; exit 1; }
[ "$(id -u)" -eq 0 ] || fail "must run as root"
# Give USB a moment on boot
sleep 5
lsusb 2>/dev/null | grep -qi "$VIDPID" || fail "dongle not detected (missing $VIDPID)"
log "OK: dongle detected ($VIDPID)"
[ -x "$LOADER" ] || fail "loader missing/not executable: $LOADER"
"$LOADER" start || true
# Wait a bit for tty creation
for i in 1 2 3 4 5; do
[ -e "$DEV" ] && break
sleep 1
done
[ -e "$DEV" ] || fail "$DEV not found (driver not attached)"
chmod 666 "$DEV" || fail "chmod failed on $DEV"
log "OK: $DEV ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment