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

Re: SysV init scripts

As a proof of concept I quickly wrote a tiny C program to go through
the /etc/rc?.d and /etc/init.d directories and output a list with one line
for each file in /etc/init.d with the format:

script {level}{S/K}{order} ...

where level is the run-level of the link, S/K is the type of link (start or
kill) and order is the number after the S or K. As an example, the entry
for xdm in my system looks as follows:

xdm 0K01 1K01 2S99 3S99 4S99 5S99 6K01

This means that xdm is stopped when entering run-levels 0,1 and 6, and it is
started when switching to run-levels 2,3,4 and 5.

This program also does the opposite, i.e., it takes input in that form from
a file and re-arranges the symlinks in /etc/rc?.d accordingly. Since it is 
written in C, it does it real fast.

One could keep a file with the local symlink policy and run it after upgrading
packages messing with the symlinks to re-enforce it. The program only touches
the files explicitely listed. All other symlinks are left intact. The program
does, however, warn upon finding dangling symlinks, entries which are not
symlinks in an rc?.d directory or symlinks pointing to places other than

If you think it would be useful let me know and I will send it to the list.


Reply to: