Is there any explanation as to why it runs in the terminal and in a script but not as a startup script? Do one of these piece of logic not apply on startup?
I’m far from an expert, but the items I see that might be problems are:
certificate instead of /certificate. certificate by itself will only work if you are in the root. You use /system, so I suspect you aren’t at the root.
Startup scripts typically require a delay. 15 seconds seems to be the standard.
# wait 15 seconds
:delay 15
Note: I’ve never done anything with certificates, but do they really need to be reinstalled on each startup? And if the file name is case-sensitive, shouldn’t you just select one case and use that consistently? It should be possible to find the file (regardless of case or subdirectory), store the filename in a local variable, and then only have one certificate import command.
P.S. You helped me too–I was looking for something like [/system resource get board-name].