[Noob question] Where should I put my shell script?

I made a simple script to control the 'Internet' LED because there was no trigger for it and it's un-utilized. I'll add it to cron to run every 60 secs. I don't know where would be the right place to put my script though. /etc? I want to make sure it gets backup when I do a settings backup and for everything to be neat and where they belong.


ping -q -c 1 google.com
if [ "$?" -eq 0 ]; then                           
  echo 1 > /sys/class/leds/y1:blue:internet/brightness #turn on LED
  echo 0 > /sys/class/leds/y1:blue:internet/brightness #turn off LED

Feel free to improve the script. Let me know if it would be better as a task or a service.

i put mine at /usr/local/
Luci can do backup of those files through Backup/Flash Firmware -> Configuration

1 Like

I have a /root/bin for my scripts and I backup the /root/ anyway.

Looks like the right place. usr/local/bin follows the linux FSH convention.

1 Like

Here is the link to the linux foundation convention:

The /usr/local hierarchy is for use by the system administrator when installing software locally.