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

Re: How to install init scripts manually?



Hi,

by "reloaded the machine" I meant that I executed the "reboot"
command. I did try with telinit, but at least on Squeeze this is just
a symlink to init:

# file /sbin/telinit
/sbin/telinit: symbolic link to `init'
#


regards,
Martin

On 8/4/14, Gary Dale <garydale@torfree.net> wrote:
> On 04/08/14 06:30 AM, Martin T wrote:
>> Hi,
>>
>> I played around with a LSB init script under Squeeze(init is from
>> sysvinit package version 2.88dsf-13.1+squeeze1) for learning purposes.
>> My script is following:
>>
>> # cat /etc/init.d/test-script
>> #! /bin/sh
>> ### BEGIN INIT INFO
>> # Provides:          test
>> # Required-Start:    $all
>> # Required-Stop:     $all
>> # Default-Start:     2 3 4 5
>> # Default-Stop:      0 1 6
>> # Short-Description: test script
>> # Description:       test script
>> ### END INIT INFO
>>
>> # always executes
>> touch /tmp/test-file
>>
>> case "$1" in
>>    start)
>>      echo "Starting script test"
>>      touch /tmp/test-file-start
>>      ;;
>>    stop)
>>      echo "Stopping script test"
>>      touch /tmp/test-file-stop
>>      ;;
>>    restart)
>>      echo "Restarting script test"
>>      touch /tmp/test-file-restart
>>      ;;
>>    force-reload)
>>      echo "Force-reloading script test"
>>      touch /tmp/test-file-force-reload
>>      ;;
>>    status)
>>      echo "Status of test"
>>      touch /tmp/test-file-status
>>      ;;
>>    *)
>>      echo "Usage: /etc/init.d/test {start|stop}"
>>      exit 1
>>      ;;
>> esac
>>
>> exit 0
>>
>> #
>>
>>
>> As a next step, I made the /etc/init.d/test-script file executable and
>> added a symlink to /etc/rc3.d/("ln -s ../init.d/test-script
>> /etc/rc3.d/S23test-script") directory and changed my runlevel from
>> 2(default) to 3 with "init 3". However, the test-script was not
>> started. Then I made a symlink to /etc/rc2.d/ directory:
>>
>> # file /etc/rc2.d/S23test-script
>> /etc/rc2.d/S23test-script: symbolic link to `../init.d/test-script'
>> #
>>
>> ..and reloaded the machine, but still the script was not started. If I
>> install the script with insserv("insserv /etc/init.d/test-script")
>> then the script is started if I reload the machine. Am I correct that
>> both insserv and update-rc.d take some additional steps when enabling
>> the script besides installing the symlinks and those steps are
>> required by /sbin/init? I guess one thing is .depend.boot,
>> .depend.start and .depend.stop files, but something else?
>>
>>
>> regards,
>> Martin
> Not sure what you mean by "reloaded the machine". However check out the
> Debian wiki at https://wiki.debian.org/RunLevel and
> https://wiki.debian.org/LSBInitScripts.
>
> Did you try telinit instead of init?
>


Reply to: