Le jeudi 15 mars 2007 17:36, john gennard a écrit : > I'm trying to understand Debian's startup procedure and > follow the relevant scripts. Where can I find a tutorial > on scripting? > > For example, /etc/init.d/rc - I can roughly understand > what is happening (the comments often indicate the way), but > the finer points are obscure. I've found a tutorial written > in 2000 and a number of other things which appear to relate > to bash scripting, but none show many of the words used in > /etc/init.d/rc. Does each Distro create it's own words? >
on debian systems there is a /etc/init.d/skeleton file which is a template you can use as a starting point. See also man update-rc.d for more infos on how to setup startup scripts. Don't do it by hand! As the skeleton is quite complex, for a simple startup action you can use something like this (just be aware that it may be called several times depending on the runlevel(s) you choose) : . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Doing something" # do it... log_action_end_msg 0 ;; esac You may also have a look at /lib/lsb/init-functions which contains some system functions often used in startup scripts. -- Cédric Lucantis