startup script ?

Bas van Gils basvg at cs.ru.nl
Mon Oct 10 20:34:58 UTC 2005


On Mon, Oct 10, 2005 at 07:48:13PM +0100, dave s wrote:
> I need to start a script, as root, as my system boots, its moin.py to start
> my very own wiki server.
> 
> Can anyone point me in the direction of where I can put a call to this
> script so it is executed on startup ?

Hi,

I hope I explain this well (enough) to get it to work for you. I'm not an
expert on init-systems but I had a similar problem a while ago and managed to
fix it this way. The trick is that init scripts are placed in the "/etc/init.d"
directory. These scripts *must* have start and stop functions. In my opinion
the "/etc/init.d/ntpdate" script is a relatively straightforward example. 

Anyway, during boot init will go through the "/etc/rc.XXX/" directories (where
XXX is an placeholder for the runlevel) to see which scripts must be started
and which should be stopped per runlevel. If you inspect those rc directories
then you'll see a lot of symlinks pointing to "/etc/init.d/something". The
symlinks starting with "S" are for starting in that runlevel and "K" for
stoping / killing.

In your case the trick is to make a start/stop script and to place it in
"/etc/init.d" and then to make the proper symlinks. I'm guessing you want to
start it in runlevel 2 but you can experiment with it ;-)

Hope this helps!

  Bas

-- 
<Bas.vanGils at cs.ru.nl> - GPG Key ID: 2768A493  -  http://www.cs.ru.nl/~basvg
Radboud University Nijmegen Institute for Computing and Information Sciences





More information about the ubuntu-users mailing list