Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11

    Quote Originally Posted by makem View Post
    Thought it best to first start by using your first suggestion: /bin/bash /usr/local/bin/shutauto

    The trap worked but produced:

    Error 129 the command executing at the time of the error was v4=$BASH_COMMAND on line 1

    The script exited.

    I will not investigate that further until I check out your better second suggestion.
    Just a thought: if v4=$BASH_COMMAND is producing an error than the script will never work so that must be first I reckon. However, I must leave it for now as other things are pressing.

    I will post again when I get sorted and thanks again. I have been trying to get somewhere on this for weeks now.

  2. #12
    Linux Engineer
    Join Date
    Jul 2003
    Stockholm, Sweden
    Gentoo documentation is generally excellent but you are using a debian based distro so the setup is completely different. You should be aware of that when reading those docs (commands and file name will be different).

    Try this to see the (current) "debian way" of doing things:

    Making scripts run at boot time with Debian

  3. #13
    Thank you.

  4. $spacer_open
  5. #14
    May I ask for clarification:

    1. From the 'Making scripts run at boot time with Debian' page: /etc/init.d/blah

    Is 'blah' my autoshut script?

    2. Is the command 'touch /var/lock/blah' all I need in my 'simple script' placed in /etc/init.d/ and then update-rc.d blah

    #! /bin/sh
    # /etc/init.d/shutauto
    # Some things that run always
    touch /var/lock/shutauto
    exit 0
    3. I presume /bin/bash /usr/local/bin/shutauto in /etc/rc.local will no longer be necessary.

    Btw. using that method, my script returns an error:


    That is what I make of the instructions in the web page as I want my script to run on every boot. I am wary of trying it because I don't want to cause an indefinite loop at the next boot.

  6. #15
    I have added an LSB to my shutauto script and placed it in /etc/init.d

    I then used update-rc.d shutauto defaults

    The script reports the correct error which I create as a test (typo in filename) but it sends two emails one with the line number 1 and one with line number 51. I cannot see why at the moment.

    I also do not know what 'overrides' are in the script yet.

    I notice that the skeleton script in init.d has #!/bin/sh and if I leave that I get a 'bad trap' error. When I change it to bash it works, however I am not sure about what is happening there yet. Maybe trap is a bash command and not an sh command.

    EDIT: looking at a symlink sh > bash script in init.d (no good, this gives bad trap error so back to bash in init.d)
    Last edited by makem; 12-02-2013 at 08:06 PM.

  7. #16
    I cant get this working correctly when test errors are not introduced.

    I get an error at the /sbin/shutdown after the rsyncs are done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts