I am running debian Jessie. During startup I want to read some user input. This is done by a custom script in /etc/init.d/ and symlinks in the runlevel dirs. Now I want kdm, which is started by another init script, to be started only after my custom script is finished.

I cloud achieve this by adding something like

while test -e /tmp/kdm-boot-lock
    echo "waiting for lock-file to be deleted by custom-script"
    sleep 1

to /etc/init.d/kdm

but I would prefer a solution without changing foreign files (which might get changed by updates).

So the question is: How can I prevent that a distinct (unchanged) init script (kdm) is started before my custom script finished?


Since you're using initscripts, the right way to defer kdm until your custom script has finished is to declare a dependency from kdm on your custom script, in the LSB header:

# Required-Start: ... yourscript

in the kdm initscript, and

# Provides: yourscript

in your custom initscript.

To avoid the changes to the kdm initscript being lost on upgrades, you can copy its LSB header to an insserv override file in /etc/insserv/overrides (with the same name), and edit that instead.

  • Thanks, but this does not solve the problem. It only achieves (due to symlink naming) that kdm is started after custom_script is started but it does not achive that kdm is started after custom_script is finished. – cknoll Nov 5 '16 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.