insserv: warning: script 'XXX.sh' missing LSB tags and overrides












1















What causes insserv: warning: script 'XXX.sh' missing LSB tags and overrides, and how is it prevented?



pi@raspberrypi /etc/init.d $ sudo rm 5_*
pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^C
pi@raspberrypi /etc/init.d $


5_second_cron.sh is the following:



#!/bin/bash
while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done


EDIT. Tried the following. Script just "hung" when I executed $ sudo update-rc.d /etc/init.d/5_second_cron.



pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^.C
pi@raspberrypi /etc/init.d $


5_second_cron is the following:



#!/bin/bash
# /etc/init.d/5_second_cron

### BEGIN INIT INFO
# Provides: 5_second_cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PHP Loop
# Description: Initiate a given PHP file every 5 seconds
### END INIT INFO

while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done
exit 0


EDIT2. Messing around some more, and now this:



pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d//etc/init.d/5_second_cron









share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

    – jordanm
    Oct 10 '15 at 17:33











  • @jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

    – user1032531
    Oct 10 '15 at 17:36






  • 1





    See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

    – jordanm
    Oct 10 '15 at 17:38











  • @jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

    – user1032531
    Oct 10 '15 at 19:32
















1















What causes insserv: warning: script 'XXX.sh' missing LSB tags and overrides, and how is it prevented?



pi@raspberrypi /etc/init.d $ sudo rm 5_*
pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^C
pi@raspberrypi /etc/init.d $


5_second_cron.sh is the following:



#!/bin/bash
while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done


EDIT. Tried the following. Script just "hung" when I executed $ sudo update-rc.d /etc/init.d/5_second_cron.



pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^.C
pi@raspberrypi /etc/init.d $


5_second_cron is the following:



#!/bin/bash
# /etc/init.d/5_second_cron

### BEGIN INIT INFO
# Provides: 5_second_cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PHP Loop
# Description: Initiate a given PHP file every 5 seconds
### END INIT INFO

while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done
exit 0


EDIT2. Messing around some more, and now this:



pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d//etc/init.d/5_second_cron









share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

    – jordanm
    Oct 10 '15 at 17:33











  • @jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

    – user1032531
    Oct 10 '15 at 17:36






  • 1





    See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

    – jordanm
    Oct 10 '15 at 17:38











  • @jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

    – user1032531
    Oct 10 '15 at 19:32














1












1








1








What causes insserv: warning: script 'XXX.sh' missing LSB tags and overrides, and how is it prevented?



pi@raspberrypi /etc/init.d $ sudo rm 5_*
pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^C
pi@raspberrypi /etc/init.d $


5_second_cron.sh is the following:



#!/bin/bash
while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done


EDIT. Tried the following. Script just "hung" when I executed $ sudo update-rc.d /etc/init.d/5_second_cron.



pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^.C
pi@raspberrypi /etc/init.d $


5_second_cron is the following:



#!/bin/bash
# /etc/init.d/5_second_cron

### BEGIN INIT INFO
# Provides: 5_second_cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PHP Loop
# Description: Initiate a given PHP file every 5 seconds
### END INIT INFO

while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done
exit 0


EDIT2. Messing around some more, and now this:



pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d//etc/init.d/5_second_cron









share|improve this question
















What causes insserv: warning: script 'XXX.sh' missing LSB tags and overrides, and how is it prevented?



pi@raspberrypi /etc/init.d $ sudo rm 5_*
pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^C
pi@raspberrypi /etc/init.d $


5_second_cron.sh is the following:



#!/bin/bash
while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done


EDIT. Tried the following. Script just "hung" when I executed $ sudo update-rc.d /etc/init.d/5_second_cron.



pi@raspberrypi /etc/init.d $ sudo vi /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo chmod +x /etc/init.d/5_second_cron
pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults^.C
pi@raspberrypi /etc/init.d $


5_second_cron is the following:



#!/bin/bash
# /etc/init.d/5_second_cron

### BEGIN INIT INFO
# Provides: 5_second_cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PHP Loop
# Description: Initiate a given PHP file every 5 seconds
### END INIT INFO

while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done
exit 0


EDIT2. Messing around some more, and now this:



pi@raspberrypi /etc/init.d $ sudo update-rc.d /etc/init.d/5_second_cron defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d//etc/init.d/5_second_cron






init.d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 27 '16 at 15:15









Anthon

60.8k17102166




60.8k17102166










asked Oct 10 '15 at 17:19









user1032531user1032531

5531124




5531124





bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

    – jordanm
    Oct 10 '15 at 17:33











  • @jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

    – user1032531
    Oct 10 '15 at 17:36






  • 1





    See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

    – jordanm
    Oct 10 '15 at 17:38











  • @jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

    – user1032531
    Oct 10 '15 at 19:32



















  • I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

    – jordanm
    Oct 10 '15 at 17:33











  • @jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

    – user1032531
    Oct 10 '15 at 17:36






  • 1





    See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

    – jordanm
    Oct 10 '15 at 17:38











  • @jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

    – user1032531
    Oct 10 '15 at 19:32

















I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

– jordanm
Oct 10 '15 at 17:33





I don't see any LSB tags, you should add them. Also, an init script that doesn't return (like this one) will block booting with sysvinit.

– jordanm
Oct 10 '15 at 17:33













@jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

– user1032531
Oct 10 '15 at 17:36





@jordanm LSB tags meaning en.wikipedia.org/wiki/Linux_Standard_Base? Should I just add something like return 1?

– user1032531
Oct 10 '15 at 17:36




1




1





See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

– jordanm
Oct 10 '15 at 17:38





See: wiki.debian.org/LSBInitScripts. What you need to do is put your script in a separate file and write a proper init script to put in /etc/init.d that launches the script in the post.

– jordanm
Oct 10 '15 at 17:38













@jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

– user1032531
Oct 10 '15 at 19:32





@jordanm I hopefully did what you advised. Please see the new part of my original question under "EDIT". Thanks

– user1032531
Oct 10 '15 at 19:32










1 Answer
1






active

oldest

votes


















0














Sorry about the very late answer.



Init scripts aren't meant to run persistently. What I mean by this is that the init scripts are supposed to start the program, then exit, leaving the program running in the background. This way, the init system knows the runlevel has been reached.



Therefore, I would recommend putting your script into a separate folder, say /usr/bin.
This is what it would contain:



#!/bin/sh

while true
do
/usr/bin/php /var/www/cron.php
sleep 5
done


In your init script, put the following:



#!/bin/sh
### BEGIN INIT INFO
# Provides: 5_second_cron
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: PHP Loop
# Description: Initiate a given PHP file every 5 seconds
### END INIT INFO

case "$1" in
start)
setsid /path/to/your/script.sh >/dev/null 2>&1 < /dev/null &
;;
*)
;;
esac


This makes it so the script takes the start argument, which is the way it is invoked, and also detaches the actual script from the process as a background daemon.



After these edits, simply run:



$ sudo insserv 5_second_cron





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f235231%2finsserv-warning-script-xxx-sh-missing-lsb-tags-and-overrides%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Sorry about the very late answer.



    Init scripts aren't meant to run persistently. What I mean by this is that the init scripts are supposed to start the program, then exit, leaving the program running in the background. This way, the init system knows the runlevel has been reached.



    Therefore, I would recommend putting your script into a separate folder, say /usr/bin.
    This is what it would contain:



    #!/bin/sh

    while true
    do
    /usr/bin/php /var/www/cron.php
    sleep 5
    done


    In your init script, put the following:



    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: 5_second_cron
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: PHP Loop
    # Description: Initiate a given PHP file every 5 seconds
    ### END INIT INFO

    case "$1" in
    start)
    setsid /path/to/your/script.sh >/dev/null 2>&1 < /dev/null &
    ;;
    *)
    ;;
    esac


    This makes it so the script takes the start argument, which is the way it is invoked, and also detaches the actual script from the process as a background daemon.



    After these edits, simply run:



    $ sudo insserv 5_second_cron





    share|improve this answer






























      0














      Sorry about the very late answer.



      Init scripts aren't meant to run persistently. What I mean by this is that the init scripts are supposed to start the program, then exit, leaving the program running in the background. This way, the init system knows the runlevel has been reached.



      Therefore, I would recommend putting your script into a separate folder, say /usr/bin.
      This is what it would contain:



      #!/bin/sh

      while true
      do
      /usr/bin/php /var/www/cron.php
      sleep 5
      done


      In your init script, put the following:



      #!/bin/sh
      ### BEGIN INIT INFO
      # Provides: 5_second_cron
      # Required-Start: $remote_fs $syslog
      # Required-Stop: $remote_fs $syslog
      # Default-Start: 2 3 4 5
      # Default-Stop: 0 1 6
      # Short-Description: PHP Loop
      # Description: Initiate a given PHP file every 5 seconds
      ### END INIT INFO

      case "$1" in
      start)
      setsid /path/to/your/script.sh >/dev/null 2>&1 < /dev/null &
      ;;
      *)
      ;;
      esac


      This makes it so the script takes the start argument, which is the way it is invoked, and also detaches the actual script from the process as a background daemon.



      After these edits, simply run:



      $ sudo insserv 5_second_cron





      share|improve this answer




























        0












        0








        0







        Sorry about the very late answer.



        Init scripts aren't meant to run persistently. What I mean by this is that the init scripts are supposed to start the program, then exit, leaving the program running in the background. This way, the init system knows the runlevel has been reached.



        Therefore, I would recommend putting your script into a separate folder, say /usr/bin.
        This is what it would contain:



        #!/bin/sh

        while true
        do
        /usr/bin/php /var/www/cron.php
        sleep 5
        done


        In your init script, put the following:



        #!/bin/sh
        ### BEGIN INIT INFO
        # Provides: 5_second_cron
        # Required-Start: $remote_fs $syslog
        # Required-Stop: $remote_fs $syslog
        # Default-Start: 2 3 4 5
        # Default-Stop: 0 1 6
        # Short-Description: PHP Loop
        # Description: Initiate a given PHP file every 5 seconds
        ### END INIT INFO

        case "$1" in
        start)
        setsid /path/to/your/script.sh >/dev/null 2>&1 < /dev/null &
        ;;
        *)
        ;;
        esac


        This makes it so the script takes the start argument, which is the way it is invoked, and also detaches the actual script from the process as a background daemon.



        After these edits, simply run:



        $ sudo insserv 5_second_cron





        share|improve this answer















        Sorry about the very late answer.



        Init scripts aren't meant to run persistently. What I mean by this is that the init scripts are supposed to start the program, then exit, leaving the program running in the background. This way, the init system knows the runlevel has been reached.



        Therefore, I would recommend putting your script into a separate folder, say /usr/bin.
        This is what it would contain:



        #!/bin/sh

        while true
        do
        /usr/bin/php /var/www/cron.php
        sleep 5
        done


        In your init script, put the following:



        #!/bin/sh
        ### BEGIN INIT INFO
        # Provides: 5_second_cron
        # Required-Start: $remote_fs $syslog
        # Required-Stop: $remote_fs $syslog
        # Default-Start: 2 3 4 5
        # Default-Stop: 0 1 6
        # Short-Description: PHP Loop
        # Description: Initiate a given PHP file every 5 seconds
        ### END INIT INFO

        case "$1" in
        start)
        setsid /path/to/your/script.sh >/dev/null 2>&1 < /dev/null &
        ;;
        *)
        ;;
        esac


        This makes it so the script takes the start argument, which is the way it is invoked, and also detaches the actual script from the process as a background daemon.



        After these edits, simply run:



        $ sudo insserv 5_second_cron






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 7 at 2:46

























        answered Jan 3 at 22:41









        novicenovice

        939




        939






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f235231%2finsserv-warning-script-xxx-sh-missing-lsb-tags-and-overrides%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Loup dans la culture

            How to solve the problem of ntp “Unable to contact time server” from KDE?

            ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux