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

    Embedded linux autostart program after booting


    Hi all,

    First of all, it's the first time I'm trying to let an application autostart after booting. As well I'm quite new to embedded systems. It is a very steep learning curve.

    So I hope I'm at the correct place with my question.

    I created an application in qtcreator. this I copied onto my development board where I'm running embedded linux 3.2.0.

    Next I did the following steps:

    1. I first of all tested the app by the following command in my terminal: ./CANbus_TerminalLogger_2Busses -qws This worked like a charm.

    2. I placed the executable app in to the directory /etc/. The app is called CANbus_TerminalLogger_2Busses

    3. created a file in the /etc/init.d directory with the name S54CANapp
    Screenshot from 2017-06-16 14:08:57.png

    4. In the file I used a skeleton that I found on the web, and changed it to my wishes. (I think here is the mistake)
    HTML Code:
    #!/bin/bash
    . /etc/CANbus_TerminalLogger_2Busses -qws
    
    start() {
            echo -n "Starting CANapp: "
            #./etc/CANbus_TerminalLogger_2Busses -qws
    }
    
    stop() {
            echo -n "Shutting down CANapp: "
            killall CANbus_TerminalLogger_2Busses
    }
    
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        restart)
            stop
            start
            ;;
        *)
            echo "Usage: CANapp {start|stop|restart}"
            exit 1
            ;;
    esac
    exit $?
    ~
    So when I reboot the system now, the program doesn't start up.

    Is anybody able to tell me what I'm doing wrong?
    It's probably something very stupid!

    Kind regards,
    TMJJ

  2. #2
    The best place to autoexec a program depends on the flavor and gui manager of linux your are using. For example KDE provides a folder similar to ms STARTUP folder - usually at $HOME/.kde/Autostart.

    The next obvious place to locate a program call is in one of several "rc" startup files. Once again the exact name of the file and where it is located depends on your distro. To get you started take a look at this article and then research your distro file.
    goto linux dot com/news/introduction-services-runlevels-and-rcd-scripts

  3. #3
    your using embedded, so either put it in rc.local or in /etc/init.d

    make sure the script is executable run "ls -l" on it, make sure it's similar to rwxr-x---

  4. $spacer_open
    $spacer_close
  5. #4
    Quote Originally Posted by jwzumwalt View Post
    The best place to autoexec a program depends on the flavor and gui manager of linux your are using. For example KDE provides a folder similar to ms STARTUP folder - usually at $HOME/.kde/Autostart.

    The next obvious place to locate a program call is in one of several "rc" startup files. Once again the exact name of the file and where it is located depends on your distro. To get you started take a look at this article and then research your distro file.
    goto linux dot com/news/introduction-services-runlevels-and-rcd-scripts
    great advice except they explicitly said they were on an embedded system and stated the version. no kde/etc. and why bother posting a link to information that is 11 years old and useless at this point?

  6. #5
    Linux Guru Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    1,986
    There are many ways to skin this cat. One could even use daemontools to start it and keep alive. My Kodi frontend starts Kodi from ~/.xinitrc (after autologin), as another example. And please see man hier for your distro, executables do not belong into /etc.

  7. #6
    Quote Originally Posted by TMJJ View Post
    I created an application in qtcreator. this I copied onto my development board where I'm running embedded linux 3.2.0.
    afaics this is only a kernel version.
    from there to an embedded sytem that is able to run qt apps, is a long way.
    what exactly did you install, and how, and to what board? detailed descriptions please.
    I am not a "Linux Guru"! Get off me! The Forum software won't let me change it!
    How to ask smart questions | Don't be a Help Vampire | How to Use Code Tags
    You can post a link by removing "http://www." from it.

Posting Permissions

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