3

I've a debian minimal installation, and I just want to start a custom script at startup.

  1. I've a script at /etc/init.d/myscript,
  2. I put a chmod 700, and create symlinks to S20myscript into :

    /etc/rc2.d
    /etc/rc3.d
    /etc/rc4.d
    /etc/rc5.d
    

But then, script is NOT launched at all on startup.

When I use this script with update-rc.d (or insserv...), it works.

I don't understand, am I forced to use this command?

(and no, I don't want to use /etc/rc.local).

2 Answers 2

2

Try removing all symlinks in the rc*.d directories.

Then, try running:

update-rc.d -n myscript enable

Where -n means not-really

This will list what insserv is supposed to do : making the symlink and generating some .depend.* files

Have a look at the init.d/.depend.boot, init.d/.depend.start and init.d/.depend.stop: maybe you need to update those files as well ? If you decide to change them by hand (but what's wrong with update-rc.d?) be extra careful that further calls to update-rc.d are not going to mess with your edits...

See man startpar and man insserv in order to gain some knowledge about the usage of how these .depend.* files.

And my final advice is: use update-rc.d :)

0

What is wrong with adding it to /etc/rc.local? That is the easiest way:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.    
#
# By default this script does nothing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .