Here are some notes for setting up an autorun script on my QNAP TS-231:
Connect via ssh and issue the following commands to mount the partition where the configuration resides:
ubiattach -m 6 -d 2 / bin / mount -t ubifs ubi2:config / tmp / config
Edit the autorun.sh file:
vi / tmp / config / autorun.sh
Assign execute permissions and unmount the configuration partition:
chmod + x /tmp/config/autorun.sh umount / tmp / config ubidetach -m 6
Enable autorun.sh to start automatically from the web interface by going to “Control Panel / System / Hardware / General” and enable the “Run user-defined processes during startup” checkbox:
Source: https://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup