PDA

View Full Version : Auto running scripts off a remastered CD question.



colinmc151
11-07-2003, 01:11 PM
I'm running into a problem attempting to get a script to automatically run as user "knoppix". In essence this script must be run as the last thing before the end user gets to use the system (i.e. network needs to be up and running, the user directory need to set-up, X-Windows running, etc).

In other words what I want is where do I put the line:

/usr/local/bin/myscript

or

su - knoppix -c /usr/local/bin/myscript

Yes, I have tested the script, if I pull up a terminal window as soon as the system starts and type "/usr/local/bin/myscript" the script will run fine, it is just a case where I don't want the end users to have have to be bothered typing the above (or read I don't want to have to teach them to do the above).

I've been banging my head against a wall (on and off) on this one for a few weeks, help, and thanks in advance.

C. McGregor

rneff
11-07-2003, 05:05 PM
You will want to make this a startup script. This means to put it in one of the /etc/rc.d directories. I would suggest /etc/rc5.d. Make a file called SXXMyScript (where XX is the largest number inthe scheme) this will ensure that it is the last to be executed. This file should contain the script you want to run, i.e. the file will have one line.

/usr/local/bin/myscript
Make sure that the file had execute permissions.

arkaine23
11-10-2003, 09:58 PM
I do it like this-

su -c "/path/to/your/script" knoppix

But there's no handy rc.local to stick it ins, so....

You need to edit the contents of your script so that whatever it runs is su'd like above.

Then,

edit the default runcontrol to add the script by softlinking:

example is /etc/rc5.d (for graphical mode boot)

ln -s /usr/local/bin/myscript /etc/rc5.d/S99myscript


The S99 part defines that this is something to start and 99 ensures it will be the last thing to start. However, as I mentioned, this is run as root. SO inside your script you may have to su -c knoppix as I mentioned above.

locutus
11-10-2003, 11:40 PM
What you are looking for sounds more like something the login manager( kdm, gdm, xdm, etc ) would be handling but since Knoppix doesn't run that by default....would this work?

/home/username/.kde/Autostart/Autorun.desktop

It's how KDE is supposed to handle autostarting applications. You'd need to create the Autorun.desktop file with your script set as the executable. Then when the user starts KDE, your script gets run. Or atleast that's the idea.