MaximilianVINCENT 8 Posted March 23, 2015 Share Posted March 23, 2015 I have a program at /usr/bin/cc.lua that I want to run after booting is complete. If possible, add an argument as well (i.e. cc v ) I tried cp /usr/bin/cc.lua /autorun.lua and nothing. Then tried adding cc /usr/bin/cc.lua os.execute("cc.lua v") -- really expected this one to work os.execute(cc.lua) os.shell(cc.lua) os.shell("cc.lua v") to a clean autorun.lua and still nothing. Grr. What is the correct way to do this? Quote Link to post Share on other sites
0 dgelessus 26 Posted March 23, 2015 Share Posted March 23, 2015 The proper way to do this would be using the rc system (/etc/rc.cfg and /etc/rc.d/). I can't find any documentation on how to use it, so here's a rough guide: In the /etc/rc.d/ folder, create a new Lua script (e. g. autorun_cc.lua). The script must define a start function that can take at least one argument. That function is executed when the system is started, and can contain whatever code you want. In your case that would probably be os.execute("cc.lua v"). Now edit the /etc/rc.cfg config file. Add the name of the script (e. g. "autorun_cc") to the "enabled" list. Done. This is only the most basic thing you can do with the rc system. If you want to see how it works internally, check the /boot/99_rc.lua and /lib/rc.lua files. FYI, the autorun.lua is only executed when freshly connecting a storage device. (Might even only work on floppies.) It does nothing on the boot drive as far as I'm aware. Quote Link to post Share on other sites
0 MaximilianVINCENT 8 Posted March 23, 2015 Author Share Posted March 23, 2015 autorun.lua does work in root, had it print "Hi there" and show me the error caused by os.execute and sleep for a few seconds. It also works on other media, commonly to mount it to a certain location on the root filesystem (/home, for instance). I am going on vacation for a while, when I get back I will be trying out the rc system. Thank you! Quote Link to post Share on other sites
I have a program at /usr/bin/cc.lua that I want to run after booting is complete. If possible, add an argument as well (i.e. cc v )
I tried cp /usr/bin/cc.lua /autorun.lua and nothing.
Then tried adding
to a clean autorun.lua and still nothing. Grr.
What is the correct way to do this?
Link to post
Share on other sites