autorun.sh shows up properly but doesn't run at boot

I’ve set up an autorun.sh on a TS-451+ and everything seems correct, but I cannot get it to run.

When I look at the actual autorun.sh (by mounting /tmp/config) I see:

-rwxr-xr-x 1 admin administrators 356 2026-03-20 08:09 autorun.sh*

drwx------ 2 admin administrators 12288 2010-01-10 23:41 lost+found/

-rw-r–r-- 1 admin administrators 11700 2026-03-20 07:47 smb.conf

-rw-r–r-- 1 admin administrators 9 2026-03-20 07:47 smb.conf.cksum

-rw-r–r-- 1 admin administrators 37 2026-03-20 07:38 system.map.key

-rw-r–r-- 1 admin administrators 11401 2026-03-20 08:12 uLinux.conf

When I look in ControlPanel→Hardware I see

This looks correct to me. What I am trying to accomplish is to turn off the ssh login menu, set up some environment variables and to set my default route to a USB QNAP 5gbps ethernet adapter. This same set of command works perfectly if I run it as root from and ssh session but will not run at startup. I added the delay in case autorun runs before the network and filesystems are all mounted.

Any advice on how to make this work would be appreciated.

The SSH login menu can be turned off in GUI

Your autorun.sh is set to be executed at startup? (setting is hidden by the popup in the screenshot)

Sorry for not showing that but it is turned on.

I’ll look for that menu entry in the GUI.

I still need the autoexec to run after each boot to set my network routing up. For some reason, the QNAP won’t automatically route thru the USB ethernet, even though it is the only NIC attached to the box. That leaves it only talking my class c here at the house. I can’t figure out why it won’t run.

It’s here

@tangential, try capturing the output from your autorun.sh (both stdout and stderr) to a log file and examine the log later for issues.

To do this, insert this new line to your autorun.sh after the hashbang line:

exec > /var/log/autorun.log 2>&1

Thanks! Testing that now!

Tested it. Apparently eth4 is not yet active at that point. I guess I need a longer delay in the script? I’ve got 60 seconds in there now I guess maybe I should try 180?

Here’s what I found:

[admin@NAS0ECB0C ~]# cd /var/log

[admin@NAS0ECB0C log]# ls -l au*

-rw-r–r-- 1 admin administrators 26 2026-03-20 16:22 autorun.log

[admin@NAS0ECB0C log]# cat autorun.log

Cannot find device “eth4”

[admin@NAS0ECB0C log]# ifconfig eth4

eth4 Link encap:Ethernet HWaddr 24:5E:BE:81:62:26

      inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0

      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

      RX packets:9574 errors:0 dropped:23 overruns:0 frame:0

      TX packets:3702 errors:0 dropped:0 overruns:0 carrier:0

      collisions:0 txqueuelen:1000

      RX bytes:1889384 (1.8 MiB)  TX bytes:3006272 (2.8 MiB)

Yes, or you could create a loop to check for it and only proceed when it’s found. :nerd_face:

I noticed your script attempts to access eth4 via the ip command, but you later manually check for eth4 using ifconfig. Might be relevant when checking for eth4 in your script.

How to Confirm Whether autorun.sh Actually Runs at Boot | QNAP