[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running a program at system startup




On Aug 20, 2007, at 2:20 PM, srgqwerty wrote:

Create a script in /etc/init.d and make a symbolic link to it in the rc
runlevel directory that corresponds to your runlevel (or whatever runlevel
you want the script to run).

So just chuck it in anywhere? Does it matter who owns the file? Should it be the user? root?

For example, the /etc/init.d/foo.sh may be:
#!/bin/bash
cd /foo
/foo/make_something.sh

If you want this script to run in runlevel 2, then you can:
ln -s /etc/init.d/foo.sh /etc/rc2.d/S99foo

So I'd make the file, put it somewhere in /etc/init.d then symlink it to /etc/rc2.d ? Seems kinda... random to me.

In the other hand, at any moment you can now the runlevel in what you are just
typing:
who -r

Have a look at /etc/init.d scripts, they are self explanatory.

There's no directory in /etc/init.d called scripts. I know nothing about shell scripting and many of you seem to assume that I know what I'm doing here. I'm a Mac guy, command lines still scare me.

Also, have a look at "man init"

Regards

On Monday 20 August 2007 21:00, ArcticFox wrote:
Here's the situation; I have a program that needs to run at system
startup, but there are a few issues with that. First, it must be run
with a certain directory as the working directory. Second it must be
run as the user 'Fox'

The information I've been able to find would end up with the program
running as root and not from the right directory. I'm used to Macs and
have no idea what I'm doing here, but I'm learning!

Thanks.



Reply to: