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

Re: which file is as the same as linux's /etc/rc.d/rc.local in debian?



Hi,

I don't believe there's one single file for site-local initialisation. Instead, you would write your own file and keep it in /etc/init.d, then symlink to it from /etc/rc<blah>.d, where you replace "<blah>" with the runlevel you want it to be initialised at. I'm looking at the policy manual:

http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit

I've never done this myself, but say you want to start your foo server at startup. First you create a script /etc/init.d/bar which runs your program. You can make it do different things depending on whether the option is "start", "stop", "reload" or whatever - look at the existing scripts to see what's possible.

You then make a symlink from /etc/rc2.d (assuming you want it to start at runlevel 2). The links in that directory have to be called "S<two digit number><name>", and they're run in order of the numbers, so you can control which order they're run in. Say there's already a file initialising the bar server called "S25bar", and you want to run right after that. Then make a symlink from /etc/rc2.d/S26foo to /etc/init.d/foo.

A quicker, hacky way would be to modify one of the existing scripts in /etc/init.d: just add your commands under the "start" section. But I wouldn't recommend that, since it might cause conflicts when you upgrade whatever package you're piggy-backing on.

黄 俊源 wrote:


_________________________________________________________________
享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com



Reply to: