LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How can I get the computer to boot up and run a program/game w/ bash script or C++? (https://www.linuxquestions.org/questions/programming-9/how-can-i-get-the-computer-to-boot-up-and-run-a-program-game-w-bash-script-or-c-168360/)

DaMan101 04-09-2004 10:33 PM

How can I get the computer to boot up and run a program/game w/ bash script or C++?
 
I'm not sure if this goes under programming or Linux from scratch, so I will put it in both. My question: Is there a way to get the computer to boot up, and run a program such as a game (no log in), either with some sort of bash script, or in place of bash, programmed in C++? If there is, how would I accomplish this? The system would need to shut down as soon as the game quit. Plus if the power was to shut off abruptly, the computer would still be able to boot, with no i-node errors. I would not even need to have a good computer because it should (hopefully) be a very stripped down Linux (no GUI). This is for an arcade game I'm programming for fun in C++ and Allegro, and I want to build an upright arcade case to put it in. The game will be a top down flight simulation (I hope that won't stop you from helping ;) ).

Thank You,
J. C.

elconde 04-10-2004 02:25 AM

man inittab

exodist 04-11-2004 01:15 AM

/etc/rc.d contains all the scripts, if you are on a slack system it is about 8 scripts, change the rc.3 script, add a reference tou your own script at the end, then when the game is done in your script have it run init 0 to shut down the computer (init 6 to reboot)

if it is a redhat clone system it has scripts in /etc/initd(or something) that are linked to directories /etc/rc.d/rc.x

for what you want I would set initrc to runlevel 1, put only needed scripts including your own into rc1 directory and have all the shudown stuff run in runlevel1 after your stuff. if this is to vague then you might not be ready to tackle this, do some reasurch on the startup files, I neather want to, nor am I capeable of stepping you through this completely. sorry.

jbstew32 04-11-2004 04:39 AM

put it in your startup folder :)

DaMan101 04-11-2004 02:02 PM

Thank you for your responses. I'm not sure I am presently good enough in scripting, so I'll try what exodist said, and if it doesn't work I will read up some more. Thanks again.

exodist 04-11-2004 03:22 PM

http://www.tldp.org/LDP/abs/html/

that is a VERY VERY VERY good shell scripting guide, very easy to understand, I failed a programming class (they taught VB and Pseudocode combined into a crappy ass language thats why I failed) then I read that and started a sourceforge project and got very into the shell scripting (more skimmed than read :-/) after that I took intro to programming at another school where they taught java and those bash skills helped me to ACE the class, now I am in my 3'rd quarter of programming taking java C#, and C++ simeltaniously. The bash stuff is easy and a good starting point, so definately go for it, and don't wait for it to happen get there and DO IT. lol good luck


All times are GMT -5. The time now is 04:08 PM.