PDA

View Full Version : Getting a program started at startup??



bhavin
05-14-2004, 10:05 AM
I need to start a program TRY.OUT which I have made using g++ in knoppix-autoconfig, but when I specify ./TRY.OUT in knoppix-autoconfig it gives "/etc/rcS.d/S00knoppix-autoconfig ./TRY.OUT file not found".
I copied TRY.OUT in /etc/rcS.d/TRY.OUT as well as /etc/init.d/TRY.OUT ; but still the problem is there.
Can anybody please help me.
ThankYou in advance...

arkaine23
05-17-2004, 06:27 PM
You may not want it running as part of knoppix-autoconfig, especially if it depends on other services such as networking components and the like.

Best is to create a startup script for it.

cd /etc/init.d
vi tryout

(Use another editor if you don't like vi)

This will be a very simple shell script to start your application.

#!/bin/sh
cd /dir/where/TRY.OUT/is/saved
./TRY.OUT



Save it and exit. Make it executable.

chmod +x tryout


Now link it into your default run control folder (rc5.d for a graphical boot).

cd /etc/rc5.d
ln -s ../init.d/tryout S99tryout


You link will start with S##, which indicates it is a script that starts a program/service, and the numbers indicate the order compared to other services that it will start. S99 would make it the last thing to start.

bhavin
05-18-2004, 11:07 AM
Thank You for all your help. Hope this works. One question that still bother's me is, are these scripts kept in /etc/rc5.d started as root, and if I have installed Knoppix on my hard drive, are this scripts started before I login ??
Thanking you in advance ...

arkaine23
05-21-2004, 04:25 PM
Yes, these are started as root and they start before you login.

change the last line of the script to-

su -c "./TRY.OUT" knoppix

if you want it to be started by the user knoppix.