LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-09-2004, 10:33 PM   #1
DaMan101
LQ Newbie
 
Registered: Oct 2003
Distribution: Slackware
Posts: 3

Rep: Reputation: 0
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.
 
Old 04-10-2004, 02:25 AM   #2
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Rep: Reputation: 15
Question

man inittab
 
Old 04-11-2004, 01:15 AM   #3
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 46
/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.

Last edited by exodist; 04-11-2004 at 03:23 PM.
 
Old 04-11-2004, 04:39 AM   #4
jbstew32
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Distribution: Debian 3.1
Posts: 149

Rep: Reputation: 15
put it in your startup folder
 
Old 04-11-2004, 02:02 PM   #5
DaMan101
LQ Newbie
 
Registered: Oct 2003
Distribution: Slackware
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 04-11-2004, 03:22 PM   #6
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 46
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run one bash script from within another? babag Programming 9 04-28-2005 12:12 AM
How can I get the computer to boot up and run a program/game w/ bash script or C++? DaMan101 Linux From Scratch 1 04-10-2004 12:23 AM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM
run programs on a remote computer with script, how? cmisip Linux - Networking 5 07-07-2003 01:48 PM
How do I automatically run at boot an X program or script cmisip Linux - General 4 01-05-2003 06:30 PM


All times are GMT -5. The time now is 11:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration