darkrising 4 Posted October 12, 2014 Share Posted October 12, 2014 Hello, I'm trying to get a program to autorun on boot using an in-game server. If I put it in the /autorun.lua file the shell runs afterwards so I get this horrible mess of text on the remote display. What is the best way to autorun a program on boot after the shell has loaded? Quote Link to post Share on other sites
0 Solution Sangar 92 Posted October 13, 2014 Solution Share Posted October 13, 2014 Not sure how reversing the order will not mess up the text when it does now, but the easiest way is probably to register a oneshot timer (using event.timer). Quote Link to post Share on other sites
0 novotd00 0 Posted January 1, 2017 Share Posted January 1, 2017 Uff, I don't know how about you, but I am doing it as autorun.lua in root directory, works just fine, I can load/unload chunks, restart server, log in/out, reboot OC, no problems at all. Autorun in root is loaded after shell, I suppose. Quote Link to post Share on other sites
0 Void_Seeker 0 Posted January 2, 2017 Share Posted January 2, 2017 I tried to create an autorun.lua in the root, home, and mnt directories and I get nothing. I checked via lua if autorun is enabled, and it is. I'm not much a programmer at all, but this was one reason I like ComputerCraft back in the day, just had to edit startup and you're done. I love OpenComputers, but I just can't find a tutorial on autorun scripts that are current. I appreciate any assistance. Quote Link to post Share on other sites
1 Fingercomp 37 Posted January 3, 2017 Share Posted January 3, 2017 IIRC, OpenOS 1.6 doesn't load authorun.lua at root fs. This means that you either should add a command to /home/.shrc (this's the preferred way), or modify boot scripts. I guess the program you want to start automatically on boot doesn't require to be run before the shell loads, so just write the path to your program to /home/.shrc. /home/bin/my-program.lua Quote Link to post Share on other sites
0 novotd00 0 Posted January 3, 2017 Share Posted January 3, 2017 You can just simply modify boot script to run certain program in certain path. I like using 99_rc.lua to change my resolution at startup, almost on all my PCs there, sou you can just add a line that will run a program. Hope this helped Edit: I suppose you can run whole program there, as whell is loaded, but I am not sure and this is just my random thought, you can try tho Quote Link to post Share on other sites
0 Fingercomp 37 Posted January 4, 2017 Share Posted January 4, 2017 Creating a script in /boot is a poor idea unless the program must be run only when computer starts. Boot scripts are intended to initialize the system. Using /home/.shrc is preferred (this will run the program each time the shell boots, though). @novotd00 I'd just put resolution <x> <y> to /home/.shrc. That's much better than adding code to a file with a completely different purpose (in your case the purpose is to initialize the rc system). By the way, payonel listed the ways to make a program run automatically here. Quote Link to post Share on other sites
0 novotd00 0 Posted January 4, 2017 Share Posted January 4, 2017 @Fingercomp thank you for your advice. But honestly, I never ran in to a problem when changing my res via that boot script, and yes, I know that it could be done in a better fashion. On my next computers I will definitly do it better, just I'm too lazy. Also, one question, is there any way to multitask or keep updated informations? Also, can I have while loop that waits for event A OR B to happen? I am working on something 'like' ''OS'', just some sort of GUI with different apps and some network capability. Quote Link to post Share on other sites
0 Fingercomp 37 Posted January 5, 2017 Share Posted January 5, 2017 It's better to create a topic with your questions. Anyway, I can answer the second question right here. You need to use event.pullMultiple("event1", "event2", ...). It will stop listening when either event1 or event2 is pushed. Quote Link to post Share on other sites
Hello, I'm trying to get a program to autorun on boot using an in-game server.
If I put it in the /autorun.lua file the shell runs afterwards so I get this horrible mess of text on the remote display.
What is the best way to autorun a program on boot after the shell has loaded?
Link to post
Share on other sites