I have simple /etc/init.d/myscript startup script in my Debian squeeze that just logs to file:

echo "starting init.d script" >> /opt/aaa/starting.log

I did all actions to register script:

sudo chmod +x myscript
sudo chown root:root myscript
sudo update-rc.d myscript defaults
sudo update-rc.d myscript enable

But can't get record in /opt/aaa/starting.log file.

How to fix that problem?

  • You have to start the service. – Michael Hampton Jan 4 at 16:06
  • what is the simplest way to check if system is trying to start myscript then? – vico Jan 4 at 16:23
  • Start it yourself? – Michael Hampton Jan 4 at 16:23
  • I can start script by myself without problems sudo ./myscript . But why system does't want to start it? – vico Jan 4 at 16:50
  • Check your system logs. – Michael Hampton Jan 4 at 16:53

You are missing mandatory headers, that's why update-rc.d can not setup your script to be started at system boot.

From /etc/init.d/README

All init.d scripts are expected to have a LSB style header documenting
dependencies and default runlevel settings.  The header look like this
(not all fields are required):

# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $portmap
# Should-Stop:       $portmap
# X-Start-Before:    nis
# X-Stop-After:      nis
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.

More information on the format is available from insserv(8).  This
information is used to dynamicaly assign sequence numbers to the
boot scripts and to run the scripts in parallel during the boot.
See also /usr/share/doc/insserv/README.Debian.

First try to understand a working init script (like ssh), and then try to adapt to your usage.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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