I'm looking for good resources to learn more about how to write/debug/maintain init.d scripts on Ubuntu.
Do you have any links or books to recommend ?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
These days init is actually being replaced by upstart in Ubuntu server. So what you probably want to do if you are writing these scripts is to try to write upstart ones instead of init. Here is a Getting Started Guide for upstart in Ubuntu.
This seemed pretty good. You also want to learn as much about bash as you can.
/etc/init.d directory, there's a
skeleton file. You can use that as the basis for writing your own init script.
Remember that everything in the specific runlevel directory,
/etc/rc1.d and so forth are symbolic links (
ln /etc/init.d/myscript /etc/rc2.d/S50myscript -s, for example.) to scripts in
The first letter of the link,
K, means to execute it when entering the runlevel (S), or leaving the runlevel (K). The two digits after that letter determine the order
init calls it when that runlevel is entered.
Debugging is accomplished through liberal use of the
echo command so you know what the script it doing, and thorough testing.