How can I have system command(s) run on boot?

I failed with reference to the method on the wiki.
I have tried the following three files and have not executed them.

/opt/vyatta/etc/config/scripts/vyatta-postconfig-bootup.script
/config/scripts/vyos-postconfig-bootup.script
/etc/rc.local

This is the command I need to execute.

echo '''deb http://mirrors.xxxx.com/debian/ jessie main non-free contrib
deb http://mirrors.xxxx.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.xxxx.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.xxxx.com/debian/ jessie main non-free contrib
deb-src http://mirrors.xxxx.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.xxxx.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.xxxx.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.xxxx.com/debian-security/ jessie/updates main non-free contrib''' > /etc/apt/sources.list

Hello, @toadzhou!
We recommend to use /config/scripts/vyos-postconfig-bootup.script, as this file will be keept after reboot and upgrades.
As I know, this file is not created during install, so there is a little chance, that you may have forgot to set correct attributes. Check if you set execution bit (chmod +x /config/scripts/vyos-postconfig-bootup.script).

1 Like

Thank you for your answer
I tried the script to execute, but it failed when I operated echo 1 > /etc/apt/sources.list
I tried echo 1 > /tmp/test.log is in effect
I think it may be that the rc startup item is related to a certain order of the system.

I can’t be sure, but it seems, that sources.list can be cleared by some internal scripts. Workaround: use /etc/apt/sources.list.d/yourreponame.list instead.

Wow, it’s so cool, I can give up writing /etc/profile.
thank you very much!