Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
darkrising

Best way to autorun a program on boot?

Question

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

8 answers to this question

Recommended Posts

  • 1

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

 

Link to post
Share on other sites
  • 0

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. 

Link to post
Share on other sites
  • 0

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 ;)

Link to post
Share on other sites
  • 0

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.

Link to post
Share on other sites
  • 0

@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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.