How to Autorun a program using busybox after boot?












1















I am using an embedded linux with busybox. I would like to automatically run my app called "myApplication" (runlevel 5 after boot all the services are up).



What I have done so far:




  • I made a script under /etc/init.d/ called S90myscript

  • Then I added this line to the inittab:


::sysinit:/etc/init.d/S90myscript



The script contains the following:



! /bin/sh
### BEGIN INIT INFO
# Provides: myApplication
# Should-Start: $all
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 5
# Default-Stop: 0 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#

set -e

. /lib/lsb/init-functions
PATH=/root:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAMNAME="myApplication"
case "$1" in
start)
$PROGRAMNAME
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0


Am I missing something? Symlinks? Is what I did wrong?



Thank you in advance










share|improve this question




















  • 1





    Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

    – cas
    Feb 21 '18 at 1:34
















1















I am using an embedded linux with busybox. I would like to automatically run my app called "myApplication" (runlevel 5 after boot all the services are up).



What I have done so far:




  • I made a script under /etc/init.d/ called S90myscript

  • Then I added this line to the inittab:


::sysinit:/etc/init.d/S90myscript



The script contains the following:



! /bin/sh
### BEGIN INIT INFO
# Provides: myApplication
# Should-Start: $all
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 5
# Default-Stop: 0 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#

set -e

. /lib/lsb/init-functions
PATH=/root:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAMNAME="myApplication"
case "$1" in
start)
$PROGRAMNAME
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0


Am I missing something? Symlinks? Is what I did wrong?



Thank you in advance










share|improve this question




















  • 1





    Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

    – cas
    Feb 21 '18 at 1:34














1












1








1








I am using an embedded linux with busybox. I would like to automatically run my app called "myApplication" (runlevel 5 after boot all the services are up).



What I have done so far:




  • I made a script under /etc/init.d/ called S90myscript

  • Then I added this line to the inittab:


::sysinit:/etc/init.d/S90myscript



The script contains the following:



! /bin/sh
### BEGIN INIT INFO
# Provides: myApplication
# Should-Start: $all
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 5
# Default-Stop: 0 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#

set -e

. /lib/lsb/init-functions
PATH=/root:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAMNAME="myApplication"
case "$1" in
start)
$PROGRAMNAME
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0


Am I missing something? Symlinks? Is what I did wrong?



Thank you in advance










share|improve this question
















I am using an embedded linux with busybox. I would like to automatically run my app called "myApplication" (runlevel 5 after boot all the services are up).



What I have done so far:




  • I made a script under /etc/init.d/ called S90myscript

  • Then I added this line to the inittab:


::sysinit:/etc/init.d/S90myscript



The script contains the following:



! /bin/sh
### BEGIN INIT INFO
# Provides: myApplication
# Should-Start: $all
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 5
# Default-Stop: 0 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#

set -e

. /lib/lsb/init-functions
PATH=/root:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAMNAME="myApplication"
case "$1" in
start)
$PROGRAMNAME
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0


Am I missing something? Symlinks? Is what I did wrong?



Thank you in advance







startup busybox buildroot autostart






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 21 '18 at 10:54









JigglyNaga

3,918932




3,918932










asked Feb 20 '18 at 12:22









AJ GSAJ GS

65




65








  • 1





    Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

    – cas
    Feb 21 '18 at 1:34














  • 1





    Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

    – cas
    Feb 21 '18 at 1:34








1




1





Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

– cas
Feb 21 '18 at 1:34





Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon.

– cas
Feb 21 '18 at 1:34










1 Answer
1






active

oldest

votes


















0














Found the solution.




  1. I placed "myApplication" in /usr/sbin/

  2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript
    (notice that there is no .sh and I had to run sudo chmod 755 on this script)

  3. Added the following line at the end of "rcS" file located in /etc/init.d/ just before the command "done":


myApp &



After rebooting the system, myApplication autoruns.






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%2f425389%2fhow-to-autorun-a-program-using-busybox-after-boot%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














    Found the solution.




    1. I placed "myApplication" in /usr/sbin/

    2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript
      (notice that there is no .sh and I had to run sudo chmod 755 on this script)

    3. Added the following line at the end of "rcS" file located in /etc/init.d/ just before the command "done":


    myApp &



    After rebooting the system, myApplication autoruns.






    share|improve this answer




























      0














      Found the solution.




      1. I placed "myApplication" in /usr/sbin/

      2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript
        (notice that there is no .sh and I had to run sudo chmod 755 on this script)

      3. Added the following line at the end of "rcS" file located in /etc/init.d/ just before the command "done":


      myApp &



      After rebooting the system, myApplication autoruns.






      share|improve this answer


























        0












        0








        0







        Found the solution.




        1. I placed "myApplication" in /usr/sbin/

        2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript
          (notice that there is no .sh and I had to run sudo chmod 755 on this script)

        3. Added the following line at the end of "rcS" file located in /etc/init.d/ just before the command "done":


        myApp &



        After rebooting the system, myApplication autoruns.






        share|improve this answer













        Found the solution.




        1. I placed "myApplication" in /usr/sbin/

        2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript
          (notice that there is no .sh and I had to run sudo chmod 755 on this script)

        3. Added the following line at the end of "rcS" file located in /etc/init.d/ just before the command "done":


        myApp &



        After rebooting the system, myApplication autoruns.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 21 '18 at 10:38









        AJ GSAJ GS

        65




        65






























            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%2f425389%2fhow-to-autorun-a-program-using-busybox-after-boot%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

            How to make a Squid Proxy server?

            第一次世界大戦

            Touch on Surface Book