LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-04-2008, 06:32 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
starting a programme from boot script in Etch


Hi all I'm trying to get a programme to run from startup script, my script runs fine ie will say hello world, but won't start the programme. To run the programme from my start up I type

cd /root/software
./game


However this won't work, can anyone advise me how to I can tell my startup to go to a directory and start a game? Thanks
 
Old 02-04-2008, 06:50 AM   #2
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Your script needs to be executable, but also properly set up. Store it in your home-dir, that's fine. Then, once the script works, you'd have to make a sym-link from the /etc/rc2.d dir to the script. Post your script to see if it's ok.
 
Old 02-04-2008, 07:41 AM   #3
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Thanks Dutch Master but I'm unsure about some of your points, I'm using Etch and running the script (start up) from etc/init.d, I've made it executable by the
chmod -x startup
and made it run from
update-rc.d startup defaults.
my script runs as it will do things like print hello world.


Do I need to make it run from a hight number eg s99? To stop any conflicts?
If so I'm not sure how to allocate it's number base? thanks
 
Old 02-04-2008, 07:44 AM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Yes, you'll need a number in the sym-link, otherwise the kernel doesn't know when to execute the script in the boot-sequence.
 
Old 02-04-2008, 08:13 AM   #5
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Thanks but no luck. I really don't now why it won't start the game
 
Old 02-04-2008, 08:39 AM   #6
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
You still didn't post the script, so I can't tell if that's OK....
 
Old 02-04-2008, 09:05 AM   #7
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Sorry my script says

echo "script running"
startx
./../../root/gamedirs/game




I think it's something to do with my code running using x? So it's trying to start before x has initialized?


I tried starting x from inside the code rather than from a startup script, eg system("startx") but this just does the same start x windows but no game running

Last edited by knobby67; 02-04-2008 at 09:06 AM.
 
Old 02-04-2008, 09:20 AM   #8
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Your script isn't a script yet:
Code:
#! /bin/bash
# startup script

startx
sh /root/gamedirs/game

exit 0
This is However, X should start automatically if you've installed a window manager like xdm/kdm/gdm so you could ommit that part. I have a feeling you're trying to solve part of a larger problem, but if you tell us the exact problem in full (e.i. what you want to achieve) we can help you better.
 
Old 02-04-2008, 09:33 AM   #9
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Hi I'm using a min install of Etch with xorg core. I'm running it in an old arcade cabinet for arcade emulators. If you just install xorg on etch you need to manually start X. It's running great except I need to do a startx and ./game to run. I want to get rid of this step and the use of a keyboard .
I run min Etch as it boots very fast.

However my game/frontend uses GLX so x need to be running.

I'm sure it's because my frontend tries to run before x has started fully, and my tests seem to confirm this but I'm ussure how to solve this?
Thanks
 
Old 02-04-2008, 07:42 PM   #10
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
OK, I understand. Your next step is one of 2 options:
a) tell the script to wait a certain time before executing the next command. You'll need to specify the waiting time long enough to be sure that X has started properly. This is the easiest option, but requires an absolute 100% guarantee that the X server will start within that time. (hint: you'll need the sleep command)
b) tell the script to test a specific X-related file to exist and it's contents before starting the next command. For this you'll need a loop and determine the outcome of all possibilities that the loop can give you. This is the most difficult but safest way.

Learn about scripting here: http://tldp.org/LDP/abs/html/
 
Old 02-05-2008, 03:38 AM   #11
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Thanks dutch master tried the sleep but it doesn't work. I know the problem now, as far as I can tell whenever you start up X it produces the display as the very last thing. When you use GLX you call a display pointer, pointing to the screen, however as the very last thing in the boot sequence is to produce the screen it gives a null pointer, so no gui stuff can ever be produced before the actually system has booted up. The only way to start it is to use gnome or kde startup stuff.
So looks like I'll have to install gnome-core.

Hope tha makes sense basically x produces the screen pointer last thing, so whereever you call your code your variable to the screens returns null and segmentation faults.
 
  


Reply



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
Internet superserver not starting debian etch kushalkoolwal Debian 4 07-18-2007 03:26 PM
Error: Unable to boot /install/2.6/linux when starting Etch Install BuckRogers01 Debian 4 08-06-2005 06:40 PM
starting the script at boot time hudy_rob Mandriva 4 12-09-2004 10:29 AM
starting a script on boot jax8 Linux - Newbie 1 03-19-2004 10:38 PM
how to auto-load a exccutale programme to turbolinux8 when linux is starting up. tobelinuxer Linux - Newbie 1 11-22-2003 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:15 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration