0

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?

vico
  • 99
  • 2

1 Answers1

1

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):

### BEGIN INIT INFO
# 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.
### END INIT INFO

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.

Chaoxiang N
  • 1,218
  • 4
  • 10