Skip to content

Instantly share code, notes, and snippets.

@amercier
Last active January 10, 2024 08:31
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save amercier/e64ee30eb3f96fcc42e3 to your computer and use it in GitHub Desktop.
Save amercier/e64ee30eb3f96fcc42e3 to your computer and use it in GitHub Desktop.
Turn leds on/off on Synology DiskStation

Synology scheduled tasks

Usage

Go to Control Panel / Task Scheduler and add the content of these scripts as root scripts.

Leds

Codes have been taken from this article.

  • turn-leds-off.sh: turns leds off
  • turn-leds-on.sh: turn leds back on

Ex (this is how I use it): turn leds daily at 10PM, turn them back on at 6AM.

#!/bin/sh
printf \\x36 > /dev/ttyS1 # UART2_CMD_LED_POWER_OFF
printf \\x37 > /dev/ttyS1 # UART2_CMD_LED_HD_OFF
printf \\x42 > /dev/ttyS1 # UART2_CMD_LED_USB_OFF
printf \\x4B > /dev/ttyS1 # UART2_CMD_LED_10G_LAN_OFF
printf \\x50 > /dev/ttyS1 # UART2_CMD_LED_MIRROR_OFF
#!/bin/sh
printf \\x34 > /dev/ttyS1 # UART2_CMD_LED_POWER_ON
printf \\x38 > /dev/ttyS1 # UART2_CMD_LED_HD_GS
printf \\x40 > /dev/ttyS1 # UART2_CMD_LED_USB_ON
printf \\x4A > /dev/ttyS1 # UART2_CMD_LED_10G_LAN_ON
printf \\x51 > /dev/ttyS1 # UART2_CMD_LED_MIRROR_GS
@stevenfoxhound
Copy link

stevenfoxhound commented Feb 10, 2021

Function code working from Task scheduler script on the DSM or from SSH:

echo 0 >/dev/ttyS1 Power on
echo 1 >/dev/ttyS1 Power off
echo 2 >/dev/ttyS1 Short beep
echo 3 >/dev/ttyS1 Long beep
echo 4 >/dev/ttyS1 Power LED on
echo 5 >/dev/ttyS1 Power LED flash
echo 6 >/dev/ttyS1 Power LED off
echo 7 >/dev/ttyS1 Status LED off
echo 8 >/dev/ttyS1 Status LED on green
echo 9 >/dev/ttyS1 Status LED flash green
echo A >/dev/ttyS1 USBCopy LED flash
echo B >/dev/ttyS1 USBCopy LED off
echo C >/dev/ttyS1 Reset
echo @ >/dev/ttyS1 USBCopy LED on
echo : >/dev/ttyS1 Status LED on orange
echo ; >/dev/ttyS1 Status LED flash orange

You can mix several code together.

echo 48 >/dev/ttyS1 Power LED on + Status LED on green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment